This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [GLIBC][AARCH64]Rewrite elf_machine_load_address using _DYNAMIC symbol
- From: Szabolcs Nagy <szabolcs dot nagy at arm dot com>
- To: Roland McGrath <roland at hack dot frob dot com>, Renlin Li <renlin dot li at foss dot arm dot com>
- Cc: <nd at arm dot com>, <libc-alpha at sourceware dot org>, Marcus Shawcroft <Marcus dot Shawcroft at arm dot com>, Richard Earnshaw <Richard dot Earnshaw at arm dot com>
- Date: Mon, 7 Nov 2016 15:23:36 +0000
- Subject: Re: [GLIBC][AARCH64]Rewrite elf_machine_load_address using _DYNAMIC symbol
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=Szabolcs dot Nagy at arm dot com;
- Nodisclaimer: True
- References: <581C57FF.2090901@foss.arm.com> <20161104212440.A23F42C3AD8@topped-with-meat.com> <58209A8B.5030702@arm.com>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
On 07/11/16 15:15, Szabolcs Nagy wrote:
> On 04/11/16 21:24, Roland McGrath wrote:
>> On many or perhaps all machines, elf_machine_load_address could now be
>> implemented purely in C by using a link-time trick.
>>
>> In C, just:
>>
>> static inline ElfW(Addr) __attribute__ ((unused))
>> elf_machine_load_address (void)
>> {
>> extern const char _BASE[] __attribute__ ((visibility ("hidden")));
>> return (ElfW(Addr)) _BASE;
>> }
>>
>> Then add a trivial input linker script to the ld.so link:
>>
>> PROVIDE_HIDDEN(_BASE = 0);
on a second thought:
why is it not ok to use _DYNAMIC instead of _BASE?
then no linker script is needed (_DYNAMIC is in the elf spec).