[RFC,1/2] newlib: Fix automake 1.16 compatibility for math object copying

Message ID 20260204181533.1498013-2-pincheng.plct@isrc.iscas.ac.cn
State New
Headers
Series Add RISC-V vector math library support |

Commit Message

Pincheng Wang Feb. 4, 2026, 6:15 p.m. UTC
  The MATHOBJS_IN_LIBC variable in newlib/Makefile.am contains a list of
object files that are copied from libm.a to libc.a, as functions like
ldexp, frexp, and modf are traditionally supplied in both libraries.

After regenerating the build system with automake 1.16.5, the actual
object file names in libm.a use the prefix "a-" instead of "libm_a-".
This appears to be related to changes in how automake handls per-target
onject naming.

This commit updates MATHOBJS_IN_LIBC to match the actual object names,
which fix build failures when the build system is regenerated:
    no entry libm_a-s_fpclassify.o in archive
    riscv64-unknown-elf-ar: libc/libm_a-s_fpclassify.o: No such file or directory

The root cause is that the stamp-libc-math-objects target attempts to
extract objects from libm.a using names like "libm_a-s_fpclassify.o", but
the actual object files in the archive are named "a-s_fpclassify.o".

This commit does not affect builds using pre-generated Makefile.in files
in the git repo, which is the normal case for the end users.

Signed-off-by: Pincheng Wang <pincheng.plct@isrc.iscas.ac.cn>
---
 newlib/Makefile.am | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)
  

Patch

diff --git a/newlib/Makefile.am b/newlib/Makefile.am
index 00088b6c3..5bdc72d80 100644
--- a/newlib/Makefile.am
+++ b/newlib/Makefile.am
@@ -113,19 +113,19 @@  rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2)$(filter $(subst *
 # both libc.a and libm.a.  We build them in libm.a and copy them over,
 # along with some required supporting routines.
 MATHOBJS_IN_LIBC = \
-	libm_a-s_fpclassify.o libm_a-sf_fpclassify.o \
-	libm_a-s_isinf.o libm_a-sf_isinf.o \
-	libm_a-s_isnan.o libm_a-sf_isnan.o \
-	libm_a-s_isinfd.o libm_a-sf_isinff.o \
-	libm_a-s_isnand.o libm_a-sf_isnanf.o \
-	libm_a-s_nan.o libm_a-sf_nan.o \
-	libm_a-s_ldexp.o libm_a-sf_ldexp.o \
-	libm_a-s_frexp.o libm_a-sf_frexp.o libm_a-frexpl.o \
-	libm_a-s_modf.o \
-	libm_a-sf_modf.o libm_a-s_scalbn.o \
-	libm_a-sf_scalbn.o \
-	libm_a-s_finite.o libm_a-sf_finite.o \
-	libm_a-s_copysign.o libm_a-sf_copysign.o
+	a-s_fpclassify.o a-sf_fpclassify.o \
+	a-s_isinf.o a-sf_isinf.o \
+	a-s_isnan.o a-sf_isnan.o \
+	a-s_isinfd.o a-sf_isinff.o \
+	a-s_isnand.o a-sf_isnanf.o \
+	a-s_nan.o a-sf_nan.o \
+	a-s_ldexp.o a-sf_ldexp.o \
+	a-s_frexp.o a-sf_frexp.o a-frexpl.o \
+	a-s_modf.o \
+	a-sf_modf.o a-s_scalbn.o \
+	a-sf_scalbn.o \
+	a-s_finite.o a-sf_finite.o \
+	a-s_copysign.o a-sf_copysign.o
 
 ## Place the libm_a objects in libc/ to keep the top dir tidy.
 stamp-libc-math-objects: libm.a