[PATCH] elf: Remove elf_machine_load_address

Florian Weimer fw@deneb.enyo.de
Sun May 26 16:38:50 GMT 2024


* H. J. Lu:

> On Sun, May 26, 2024 at 7:30 AM Florian Weimer <fw@deneb.enyo.de> wrote:
>>
>> * H. J. Lu:
>>
>> > rtld.c already uses __ehdr_start to get the ELF header and its load
>> > address:
>> >
>> > extern const ElfW(Ehdr) __ehdr_start attribute_hidden;
>> > ...
>> >   const ElfW(Ehdr) *rtld_ehdr = &__ehdr_start;
>> >
>> > Remove elf_machine_load_address and use &__ehdr_start instead.
>> >
>> > Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
>>
>> Does this really work on all HIDDEN_VAR_NEEDS_DYNAMIC_RELOC targets?
>
> How do HIDDEN_VAR_NEEDS_DYNAMIC_RELOC targets work with existing
>
> extern const ElfW(Ehdr) __ehdr_start attribute_hidden;
>
> usages in rtld.c?

These references only happen after self-relocation in _dl_start_final.
The use of elf_machine_load_address comes before that.

Historically, this code has not been very robust.  Maybe one day, we
can simplify the self-relocation procedure.


More information about the Libc-alpha mailing list