|
|
Message-ID: <20261105161546.GX3542221@port70.net> Date: Thu, 5 Nov 2026 17:15:46 +0100 From: Szabolcs Nagy <nsz@...t70.net> To: Thomas Petazzoni <thomas.petazzoni@...tlin.com> Cc: musl@...ts.openwall.com Subject: Re: ppc64 build issue: call to `_dlstart_c' lacks nop, can't restore toc * Thomas Petazzoni <thomas.petazzoni@...tlin.com> [2026-11-05 11:29:25 +0100]: > Dear musl maintainers, > > Buildroot autobuilders have detected a build issue with musl 1.2.6 > when building for PowerPC 64 (power11): > > dlstart.c:(.text+0x24): call to `_dlstart_c' lacks nop, can't restore toc; (toc save/adjust stub) > /home/autobuild/autobuild/instance-24/output-1/host/powerpc64le-buildroot-linux-musl/bin/ld: final link failed: bad value https://www.openwall.com/lists/musl/2025/12/12/7 with -mcpu=power10 or newer globals are accessed pc-relative instead of toc-relative. so no need for toc (r2) setup. the pcrel code emits calls with @notoc suffix in asm which creates a new _NOTOC reloc so the linker knows there is no need to restore toc after the call. for functions with no toc setup localentry is set to 1 (st_other in the symbol table). for toc relative (-mno-pcrel) code the linker emitted toc restore (r2) in case the call crosses dso boundary, but not for local (hidden) symbols, so musl asm was fine without nops after hidden calls. however ld assumes a localentry==1 call target clobbers toc, so even hidden call requires toc restore (in musl asm the caller does not actually use toc so we dont care if it gets clobbered but the linker does not know that). fixes: 1. build with -mno-pcrel (power9 compatible codegen) 2. add nop after calls in asm (and turn tail call into call in __dlsym) so with power10 toc restore is emitted (unnecessarily) 3. #if __PCREL__ then make calls in asm with @notoc suffix (and skip toc setup and set localentry to 1) 3 is the right fix, but 1 is a workaround you can do to use other (non-pcrel) features of power10 with musl.
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.