Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGWvnykKXpax+-5NGDB=T6OTi4DaU2WOoVSMUPtfrV2nx7Gpyg@mail.gmail.com>
Date: Thu, 11 Dec 2025 20:35:48 -0500
From: David Edelsohn <dje.gcc@...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: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.

David


>         .size   dlsym, .-dlsym
> --
> 2.51.0
>
>

Content of type "text/html" skipped

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.