Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAH8yC8nEWYRXCA+qMBggSj3jjUQmYj+GwMqj4cmPXpLLA7guUQ@mail.gmail.com>
Date: Fri, 12 Dec 2025 11:01:27 -0500
From: Jeffrey Walton <noloader@...il.com>
To: musl@...ts.openwall.com
Cc: Alex Rønne Petersen <alex@...xrp.com>
Subject: Re: [PATCH] powerpc64: add nop after b to __dlsym

On Thu, Dec 11, 2025 at 8:42 PM David Edelsohn <dje.gcc@...il.com> 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.

Based on code like this [0] :

  33 #ifndef SHARED
  34         nop
  35 #endif

That may be a nop for hot patching.

[0] <https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/powerpc/powerpc64/ppc-mcount.S>

Jeff

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.