diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2019-08-22 12:26:52 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2019-08-23 10:06:06 +0200 |
commit | 5f04e5e03e941c8cae4f42f670abba847bfbcf9d (patch) | |
tree | c8fa3fe3d61723bb5a0f7e79d9316c6f669736a1 /pbl | |
parent | fab26e665163723dab2b44c57644580f95a80500 (diff) | |
download | barebox-5f04e5e03e941c8cae4f42f670abba847bfbcf9d.tar.gz barebox-5f04e5e03e941c8cae4f42f670abba847bfbcf9d.tar.xz |
ARM: aarch64: Fix get_runtime_offset after relocation
get_runtime_offset shall return the offset between the address we are
running at and the address we are linked at. This value obviously
changes when we relocate the binary. cf3b09737b tried to avoid using
R_AARCH64_RELATIVE relocations, but in fact this is exactly what the
function needs to work. Consider barebox starting at 0x10000000
when we are linked at 0x0 then get_runtime_offset() should return
0x10000000 before relocate_to_current_adr(), but afterwards it should
return 0x0.
This patch brings back the previously removed "a" flag. Since gcc5
doesn't put the values of R_AARCH64_RELATIVE fixup'd relocations
into the binary but zeroes instead, we help ourselves by basing
get_runtime_offset on an address which actually is zero. With
CONFIG_RELOCATABLE=y the binary is always linked to 0x0, so _text
is initially zero.
Tested with gcc-5.4.0 (which was "fixed" by cf3b09737b) and gcc-8.2.1.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
Diffstat (limited to 'pbl')
0 files changed, 0 insertions, 0 deletions