|
|
Message-ID: <20251212154253.GW3520958@port70.net> Date: Fri, 12 Dec 2025 16:42:53 +0100 From: Szabolcs Nagy <nsz@...t70.net> To: David Edelsohn <dje.gcc@...il.com>, musl@...ts.openwall.com, Alex Rønne Petersen <alex@...xrp.com> Subject: Re: [PATCH] powerpc64: add nop after b to __dlsym * Szabolcs Nagy <nsz@...t70.net> [2025-12-12 16:06:25 +0100]: > * David Edelsohn <dje.gcc@...il.com> [2025-12-11 20:35:48 -0500]: > > On Thu, Dec 11, 2025 at 8:10 PM Alex Rønne Petersen <alex@...xrp.com> wrote: > > > > > To avoid errors like this: > > > > > > ld.lld: error: > > > /home/ci/.cache/act/2c84ccdd36a924eb/hostexecutor/zig-global-cache/o/9e32a733e976f6f0194dc11bcf100f7a/libc.a(/home/ci/.cache/act/2c84ccdd36a924eb/hostexecutor/zig-global-cache/o/19fa681ef1630f481aadf66ec88d2634/dlsym.o):(function > > > dlsym: .text+0xc): call to save___dlsym lacks nop, can't restore toc > > > --- > > > src/ldso/powerpc64/dlsym.s | 1 + > > > 1 file changed, 1 insertion(+) > > > > > > diff --git a/src/ldso/powerpc64/dlsym.s b/src/ldso/powerpc64/dlsym.s > > > index a14715fd..73e70db9 100644 > > > --- a/src/ldso/powerpc64/dlsym.s > > > +++ b/src/ldso/powerpc64/dlsym.s > > > @@ -8,4 +8,5 @@ dlsym: > > > .localentry dlsym,.-dlsym > > > mflr 5 # The return address is arg3. > > > b __dlsym > > > + nop > > > > > > > The instruction is > > > > b __dlsym > > > > which is a branch -- a tail call. It cannot return. It will never need a > > TOC restore instruction after the branch. > > > > As with the other patch, are you fixing actual bugs or bloating the code to > > remove false-positive linker error messages? > > > > If the target of the call (bl) in the previous patch is known to be local, > > it will never need a TOC restore. > > alan modra implies here that the linker > logic is based on relocs (which is > presumably the same for b and bl) > https://sourceware.org/bugzilla/show_bug.cgi?id=26164 > > i think the linker could check the instruction > at the target location of a reloc in the inputs > and decide how to generate the output based on > that, but maybe that was deemed too complex for on a second thought the assembler should be able to generate @notoc for b, i.e. always use the _NOTOC relocs automatically for b sym. presumably there are reasons why the compiler generates @notoc instead. i also dont know why cpu=power10 is needed to get tail calls and @notoc. but i wont dig further. > the linker abi (iirc tocs and other stubs > can already cause headaches as they change > section layout late and thus need iterative > adjustments that may not converge). > > > > > David > > > > > > > .size dlsym, .-dlsym > > > -- > > > 2.51.0 > > > > > >
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.