]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Account for LSB on DT_INIT/DT_FINI entries
authorMatthew Malcomson <matthew.malcomson@arm.com>
Thu, 28 Apr 2022 08:50:29 +0000 (09:50 +0100)
committerJohn Baldwin <jhb@FreeBSD.org>
Thu, 1 Sep 2022 22:59:25 +0000 (15:59 -0700)
commit8e87389a289e93866ada83fa0a66b6c9346d51e3
tree5ad5dffacf3d464ccd15f48e8fd04e54a0a8581c
parentdba0e3214b1fb5afe03e3089a5a5128d72fe1e93
Account for LSB on DT_INIT/DT_FINI entries

When DT_INIT and/or DT_FINI point to C64 functions they should have
their LSB set.  I.e. these entries should contain the address of the
relevant functions and not a slight variation on them.

This is already done by Morello clang, and we want GNU ld updated to
match.

Here we account for these LSB's for Morello in the same way as the Arm
backend accounts for the Thumb LSB.  This is done in the
finish_dynamic_sections hook by checking the two dynamic section
entries, looking up the relevant functions, and adding that LSB onto the
entry value.

In our testcase we simply check that the INIT and FINI section entries
have the same address as the _init and _fini symbols.
bfd/elfnn-aarch64.c
ld/testsuite/ld-aarch64/aarch64-elf.exp
ld/testsuite/ld-aarch64/morello-dt-init-fini.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/morello-dt-init-fini.s [new file with mode: 0644]