From: Florian Weimer <fweimer@redhat.com>
To: Alan Modra via Libc-alpha <libc-alpha@sourceware.org>
Cc: Adhemerval Zanella <adhemerval.zanella@linaro.org>,
Alan Modra <amodra@gmail.com>
Subject: Re: Use __ehdr_start rather than _begin in _dl_start_final
Date: Sat, 30 Apr 2022 13:27:16 +0200 [thread overview]
Message-ID: <87zgk2yfor.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <YmxuZAb3bvbxa8Y/@squeak.grove.modra.org> (Alan Modra via Libc-alpha's message of "Sat, 30 Apr 2022 08:31:56 +0930")
* Alan Modra via Libc-alpha:
> On Thu, Apr 28, 2022 at 04:37:53PM +0930, Alan Modra wrote:
>> On Wed, Apr 27, 2022 at 03:54:27PM -0300, Adhemerval Zanella wrote:
>> >
>> >
>> > On 27/04/2022 09:35, Alan Modra via Libc-alpha wrote:
>> > > __ehdr_start is already used in rltld.c:dl_main, and can serve the
>> > > same purpose as _begin. Besides tidying the code, using linker
>> > > defined section relative symbols rather than "-defsym _begin=0" better
>> > > reflects the intent of _dl_start_final use of _begin, which is to
>> > > refer to the load address of ld.so rather than absolute address zero.
>> > >
>> > > The motive for this patch is to finally tidy ppc32 GNU ld treatment of
>> > > absolute symbols. On ppc32, the reference to _begin generates a GOT
>> > > entry. A GOT entry for an absolute symbol shouldn't be dynamically
>> > > relocated, so this usage in glibc of an absolute _begin will fail once
>> > > I fix ppc32 ld. Note that on many other targets, including ppc64, gcc
>> > > generates pc relative or got-pointer relative addressing for _begin.
>> > > ie. the compiler assumes _begin is *not* at an absolute address, and
>> > > generally linkers go along with that.
>> >
>> > Does it mean that once you fix it, newer binutils will start to fail
>> > to build older glibc releases for powerpc32?
>>
>> Not necessarily. I found these issues with absolute symbols in glibc
>> by inspecting object files. Possibly dl_rtld_map.l_map_start == 0
>> causes no problem, I'll know when I have set up a test environment for
>> ppc32 that lets me build and run a ppc32 glibc.
>
> Just tst-dl_find_object regresses on a glibc ld.so that uses _begin.
I think _dl_find_dso_for_object will go wrong as well, potentially
misidentifying dlopen/dlsym/atexit callers.
But I think you should proceed with your binutils fix, and we should
backport the glibc fix.
Thanks,
Florian
prev parent reply other threads:[~2022-04-30 11:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-27 12:35 Alan Modra
2022-04-27 16:08 ` Florian Weimer
2022-04-27 18:54 ` Adhemerval Zanella
2022-04-28 7:07 ` Alan Modra
2022-04-29 23:01 ` Alan Modra
2022-04-30 11:27 ` Florian Weimer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zgk2yfor.fsf@oldenburg.str.redhat.com \
--to=fweimer@redhat.com \
--cc=adhemerval.zanella@linaro.org \
--cc=amodra@gmail.com \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).