From 81521e46e3b7c8eab9dea7939d7bcd90840254e5 Mon Sep 17 00:00:00 2001 From: Maarten Boot <11140490+maarten-boot@users.noreply.github.com> Date: Tue, 3 Nov 2026 09:34:58 +0100 Subject: [PATCH] plat descr: -l links lib.a; -lm links libc.a Every platform mapped -l to {PLATFORMDIR}/lib, without .a, so the linker could not open it: -lm and -lc failed everywhere (minix68k mapped it to the old Minix-ST lib/minixST/tail_). Map it to lib.a, and -lm to libc.a, which holds the maths functions; no platform builds a libm. em22 gets no -lm: libc.a is always linked there, and em_ass cannot take a library twice. Co-Authored-By: Claude Opus 5.5 --- plat/cpm/descr | 4 +++- plat/em22/descr | 4 +++- plat/linux386/descr | 4 +++- plat/linux68k/descr | 4 +++- plat/linuxmips/descr | 4 +++- plat/linuxppc/descr | 4 +++- plat/minix68k/descr | 4 +++- plat/msdos386/descr | 4 +++- plat/msdos86/descr | 4 +++- plat/osx386/descr | 4 +++- plat/osxppc/descr | 4 +++- plat/pc86/descr | 4 +++- plat/pdpv7/descr | 4 +++- plat/qemuppc/descr | 4 +++- plat/rpi/descr | 4 +++- 15 files changed, 45 insertions(+), 15 deletions(-) diff --git a/plat/cpm/descr b/plat/cpm/descr index 1b2b437776..ecaa066f8b 100644 --- a/plat/cpm/descr +++ b/plat/cpm/descr @@ -56,7 +56,9 @@ name led from .o.a to .out program {EM}/lib/ack/em_led - mapflag -l* LNAME={PLATFORMDIR}/lib* + # The maths functions are in libc.a: -lm links that. + mapflag -lm LNAME={PLATFORMDIR}/libc.a + mapflag -l* LNAME={PLATFORMDIR}/lib*.a mapflag -i SEPID=-b1:0 mapflag -fp FLOATS={PLATFORMDIR}/libfp.a args {ALIGN} {SEPID?} \ diff --git a/plat/em22/descr b/plat/em22/descr index c8610ddaff..42638e65cb 100644 --- a/plat/em22/descr +++ b/plat/em22/descr @@ -31,7 +31,9 @@ name asld to .out outfile e.out program {EM}/lib/ack/em_ass - mapflag -l* LNAME={PLATFORMDIR}/lib* + # No -lm: the maths functions are in libc.a, which is always linked, + # and em_ass cannot take a library twice. + mapflag -l* LNAME={PLATFORMDIR}/lib*.a mapflag -+* ASS_F={ASS_F?} -+* mapflag --* ASS_F={ASS_F?} --* mapflag -s* SIZE_FLAG=-s* diff --git a/plat/linux386/descr b/plat/linux386/descr index 9ae17a5488..2350fe2e07 100644 --- a/plat/linux386/descr +++ b/plat/linux386/descr @@ -56,7 +56,9 @@ name led from .o.a to .out program {EM}/lib/ack/em_led - mapflag -l* LNAME={PLATFORMDIR}/lib* + # The maths functions are in libc.a: -lm links that. + mapflag -lm LNAME={PLATFORMDIR}/libc.a + mapflag -l* LNAME={PLATFORMDIR}/lib*.a mapflag -fp FLOATS={EM}/{LIB}fp args {ALIGN} {SEPID?} \ ({RTS}:.b=-u _i_main) \ diff --git a/plat/linux68k/descr b/plat/linux68k/descr index d813f61a80..9a576f56f0 100644 --- a/plat/linux68k/descr +++ b/plat/linux68k/descr @@ -56,7 +56,9 @@ name led from .o.a to .out program {EM}/lib/ack/em_led - mapflag -l* LNAME={PLATFORMDIR}/lib* + # The maths functions are in libc.a: -lm links that. + mapflag -lm LNAME={PLATFORMDIR}/libc.a + mapflag -l* LNAME={PLATFORMDIR}/lib*.a mapflag -fp FLOATS={EM}/{LIB}fp args {ALIGN} {SEPID?} \ ({RTS}:.b=-u _i_main) \ diff --git a/plat/linuxmips/descr b/plat/linuxmips/descr index 7714d72726..9121e2b705 100644 --- a/plat/linuxmips/descr +++ b/plat/linuxmips/descr @@ -57,7 +57,9 @@ name led from .o.a to .out program {EM}/lib/ack/em_led - mapflag -l* LNAME={PLATFORMDIR}/lib* + # The maths functions are in libc.a: -lm links that. + mapflag -lm LNAME={PLATFORMDIR}/libc.a + mapflag -l* LNAME={PLATFORMDIR}/lib*.a mapflag -fp FLOATS={EM}/{LIB}fp args {ALIGN} {SEPID?} \ ({RTS}:.b=-u _i_main) \ diff --git a/plat/linuxppc/descr b/plat/linuxppc/descr index 9e43fabb75..983b2bb595 100644 --- a/plat/linuxppc/descr +++ b/plat/linuxppc/descr @@ -56,7 +56,9 @@ name led from .o.a to .out program {EM}/lib/ack/em_led - mapflag -l* LNAME={PLATFORMDIR}/lib* + # The maths functions are in libc.a: -lm links that. + mapflag -lm LNAME={PLATFORMDIR}/libc.a + mapflag -l* LNAME={PLATFORMDIR}/lib*.a mapflag -fp FLOATS={EM}/{LIB}fp args {ALIGN} {SEPID?} \ ({RTS}:.b=-u _i_main) \ diff --git a/plat/minix68k/descr b/plat/minix68k/descr index 461018a3aa..472719b6ff 100644 --- a/plat/minix68k/descr +++ b/plat/minix68k/descr @@ -54,7 +54,9 @@ name led from .o.a to .out program {EM}/lib/ack/em_led - mapflag -l* LNAME={EM}/{LIB}* + # The maths functions are in libc.a: -lm links that. + mapflag -lm LNAME={PLATFORMDIR}/libc.a + mapflag -l* LNAME={PLATFORMDIR}/lib*.a # mapflag -i SEPID=-b1:0 mapflag -fp LIBFP={EM}/{NLIB}fp mapflag -ansi C_LIB={EM}/{LIB}ac diff --git a/plat/msdos386/descr b/plat/msdos386/descr index b6683871b0..e2e6822e8c 100644 --- a/plat/msdos386/descr +++ b/plat/msdos386/descr @@ -44,7 +44,9 @@ name led from .o.a to .out program {EM}/lib/ack/em_led - mapflag -l* LNAME={PLATFORMDIR}/lib* + # The maths functions are in libc.a: -lm links that. + mapflag -lm LNAME={PLATFORMDIR}/libc.a + mapflag -l* LNAME={PLATFORMDIR}/lib*.a mapflag -fp FLOATS={EM}/{ILIB}fp args {ALIGN} \ ({RTS}:.b=-u _i_main) \ diff --git a/plat/msdos86/descr b/plat/msdos86/descr index 2ef1724ee4..78f66f5145 100644 --- a/plat/msdos86/descr +++ b/plat/msdos86/descr @@ -53,7 +53,9 @@ name led from .o.a to .out program {EM}/lib/ack/em_led - mapflag -l* LNAME={PLATFORMDIR}/lib* + # The maths functions are in libc.a: -lm links that. + mapflag -lm LNAME={PLATFORMDIR}/libc.a + mapflag -l* LNAME={PLATFORMDIR}/lib*.a mapflag -i SEPID=-b1:0 mapflag -fp FLOATS={EM}/{ILIB}fp args {ALIGN} {SEPID} \ diff --git a/plat/osx386/descr b/plat/osx386/descr index 045d2e7206..5f1431bc12 100644 --- a/plat/osx386/descr +++ b/plat/osx386/descr @@ -54,7 +54,9 @@ name led from .o.a to .out program {EM}/lib/ack/em_led - mapflag -l* LNAME={PLATFORMDIR}/lib* + # The maths functions are in libc.a: -lm links that. + mapflag -lm LNAME={PLATFORMDIR}/libc.a + mapflag -l* LNAME={PLATFORMDIR}/lib*.a mapflag -fp FLOATS={EM}/{LIB}fp args {ALIGN} {SEPID?} \ ({RTS}:.b=-u _i_main) \ diff --git a/plat/osxppc/descr b/plat/osxppc/descr index 77fc452604..ec7bb199d5 100644 --- a/plat/osxppc/descr +++ b/plat/osxppc/descr @@ -57,7 +57,9 @@ name led from .o.a to .out program {EM}/lib/ack/em_led - mapflag -l* LNAME={PLATFORMDIR}/lib* + # The maths functions are in libc.a: -lm links that. + mapflag -lm LNAME={PLATFORMDIR}/libc.a + mapflag -l* LNAME={PLATFORMDIR}/lib*.a mapflag -fp FLOATS={EM}/{LIB}fp args {ALIGN} {SEPID?} \ ({RTS}:.b=-u _i_main) \ diff --git a/plat/pc86/descr b/plat/pc86/descr index 4f0823c0ea..9ada826a5a 100644 --- a/plat/pc86/descr +++ b/plat/pc86/descr @@ -48,7 +48,9 @@ name led from .o.a to .out program {EM}/lib/ack/em_led - mapflag -l* LNAME={PLATFORMDIR}/lib* + # The maths functions are in libc.a: -lm links that. + mapflag -lm LNAME={PLATFORMDIR}/libc.a + mapflag -l* LNAME={PLATFORMDIR}/lib*.a mapflag -i SEPID=-b1:0 mapflag -fp FLOATS={EM}/{ILIB}fp args {ALIGN} {SEPID?} \ diff --git a/plat/pdpv7/descr b/plat/pdpv7/descr index f430c6b3c3..befb8d36f0 100644 --- a/plat/pdpv7/descr +++ b/plat/pdpv7/descr @@ -53,7 +53,9 @@ name led from .o.a to .out program {EM}/lib/ack/em_led - mapflag -l* LNAME={PLATFORMDIR}/lib* + # The maths functions are in libc.a: -lm links that. + mapflag -lm LNAME={PLATFORMDIR}/libc.a + mapflag -l* LNAME={PLATFORMDIR}/lib*.a mapflag -i SEPID=-b1:0 mapflag -n ALIGN=-a0:1 -a1:0x2000 -a2:1 -a3:1 mapflag -nr ALIGN=-a0:1 -a1:1 -a2:0x2000 -a3:1 diff --git a/plat/qemuppc/descr b/plat/qemuppc/descr index 9d1a804274..8e2e91cf6b 100644 --- a/plat/qemuppc/descr +++ b/plat/qemuppc/descr @@ -56,7 +56,9 @@ name led from .o.a to .out program {EM}/lib/ack/em_led - mapflag -l* LNAME={PLATFORMDIR}/lib* + # The maths functions are in libc.a: -lm links that. + mapflag -lm LNAME={PLATFORMDIR}/libc.a + mapflag -l* LNAME={PLATFORMDIR}/lib*.a mapflag -fp FLOATS={EM}/{LIB}fp args {ALIGN} {SEPID?} \ ({RTS}:.b=-u _i_main) \ diff --git a/plat/rpi/descr b/plat/rpi/descr index 43d3256a3d..5ba1470c13 100644 --- a/plat/rpi/descr +++ b/plat/rpi/descr @@ -47,7 +47,9 @@ name led from .o.a to .out program {EM}/lib/ack/em_led - mapflag -l* LNAME={PLATFORMDIR}/lib* + # The maths functions are in libc.a: -lm links that. + mapflag -lm LNAME={PLATFORMDIR}/libc.a + mapflag -l* LNAME={PLATFORMDIR}/lib*.a mapflag -i SEPID=-b1:0 mapflag -fp FLOATS={EM}/{ILIB}fp args {ALIGN} {SEPID?} \