|
|
Message-Id: <c400e569-3499-44bc-bf57-7cf096d26192@app.fastmail.com> Date: Fri, 12 Dec 2025 03:38:41 +0100 From: Alex Rønne Petersen <alex@...xrp.com> To: "David Edelsohn" <dje.gcc@...il.com>, musl@...ts.openwall.com Subject: Re: [PATCH] powerpc64: add nop after b to __dlsym On Fri, Dec 12, 2025, at 02:35, David Edelsohn wrote: > 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. In this particular case (__dlsym), it looks to me like LLD is clearly wrong to issue this error. I haven't investigated why it does so, but since this only happens when linking a very large executable (the Zig compiler statically linked with LLVM), I vaguely suspect that it's a bad interaction between its relocation and range extension thunk logic. I want to say that LLD is probably also wrong in the case of __start_c, but I'm less sure on that one. Unfortunately, a .hidden directive is not sufficient to silence either error. > > 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.