]> git.ipfire.org Git - thirdparty/glibc.git/commit
[AARCH64] Rewrite elf_machine_load_address using _DYNAMIC symbol
authorSzabolcs Nagy <szabolcs.nagy@arm.com>
Wed, 18 Oct 2017 16:26:23 +0000 (17:26 +0100)
committerAurelien Jarno <aurelien@aurel32.net>
Fri, 26 Jan 2018 11:03:49 +0000 (12:03 +0100)
commita5db85df69dce7fcf793fefc60c764c684e0c272
treee6e06731653a8927d12db518228c2c530b5946aa
parent51600b0fd76ce1d4a0eb1159087cab4fc3937dd6
[AARCH64] Rewrite elf_machine_load_address using _DYNAMIC symbol

This patch rewrites aarch64 elf_machine_load_address to use special _DYNAMIC
symbol instead of _dl_start.

The static address of _DYNAMIC symbol is stored in the first GOT entry.
Here is the change which makes this solution work (part of binutils 2.24):
https://sourceware.org/ml/binutils/2013-06/msg00248.html

i386, x86_64 targets use the same method to do this as well.

The original implementation relies on a trick that R_AARCH64_ABS32 relocation
being resolved at link time and the static address fits in the 32bits.
However, in LP64, normally, the address is defined to be 64 bit.

Here is the C version one which should be portable in all cases.

* sysdeps/aarch64/dl-machine.h (elf_machine_load_address): Use
_DYNAMIC symbol to calculate load address.

(cherry picked from commit a68ba2f3cd3cbe32c1f31e13c20ed13487727b32)
ChangeLog
sysdeps/aarch64/dl-machine.h