Skip to content

plat descr: -l<name> links lib<name>.a; -lm links libc.a - #392

Merged
davidgiven merged 1 commit into
davidgiven:defaultfrom
maarten-boot:upstream/descr-lflag
Nov 3, 2026
Merged

davidgiven merged 1 commit into
davidgiven:defaultfrom
maarten-boot:upstream/descr-lflag

Conversation

@maarten-boot

Copy link
Copy Markdown
Contributor

Every platform's descr maps -l<name> to
{PLATFORMDIR}/lib<name>, without .a, so the linker can't open it:

$ ack -mpc86 -o m m.c -lm
em_led: can't read .../share/ack/pc86/libm (fatal)

-lc fails the same way, on all 14 platforms with a C library. minix68k
still maps it to the old Minix-ST lib/minixST/tail_<name>. This maps
-l<name> to lib<name>.a, and -lm to libc.a, which holds the
maths functions (no platform builds a libm), so makefiles that pass
-lm work.

em22 gets no -lm: libc.a is always linked there, and em_ass can't
take a library twice ("global symbol '__ctype' redefined").

Tested: all platforms, 226 tests pass. -lm and -lc link on the 13
platforms that use em_led; a missing library is now named correctly
(can't read .../libnosuch.a). On pc86 and linuxppc the program
linked with -lm is identical to the one linked without it.

🤖 Generated with Claude Code

Every platform mapped -l<name> to {PLATFORMDIR}/lib<name>, 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_<name>). Map it to
lib<name>.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 <noreply@anthropic.com>
@davidgiven

Copy link
Copy Markdown
Owner

Goes to show how little people actually use libraries on this. Merging, thanks.

@davidgiven
davidgiven merged commit 4cbe1b0 into davidgiven:default Nov 3, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants