]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Disable some symbol -> section_symbol + offset translations
authorMatthew Malcomson <matthew.malcomson@arm.com>
Fri, 4 Nov 2022 10:01:52 +0000 (10:01 +0000)
committerMatthew Malcomson <matthew.malcomson@arm.com>
Fri, 4 Nov 2022 10:03:06 +0000 (10:03 +0000)
commitf8c6b621d4ed4cf68f595845f0222530f8d00de0
treea873ab1ed8bcec09be42ce8ba2ef7251a1f64c54
parentea22e23a0c9fbc97f7b501a9e3670c8ca764306b
Disable some symbol -> section_symbol + offset translations

We're disabling transformations of relocations against symbols like this
in the assembler when the relocation is against something in the GOT and
when the relocation is against something which generates a capability.

For entries in the GOT we disable this transformation since the GNU bfd
linker relies on indexing into its internal representation of the GOT
using symbols and does not distiinguish between entries using the same
symbol but different offsets.  Hence transforming multiple symbols into
the same section symbol with different offsets would mean that at least
one will get an incorrect value.

Relocations which require the static linker to emit dynamic relocations
in order to generate capabilities (CAPINIT and capability relocations
into the GOT) require symbol information so that the dynamic linker can
put correct permissions and bounds on those relocations.

NOTE: We get to use an existing testcase for this change, but it showed
up something strange about objdump.  One `adrp` instruction has changed
in the output so that it shows as pointing to a different location.
This happens to be an `objdump` quirk.  Objdump looks at the relocation
associated with an address and attempts to include that relocation when
determining what address to print out.  This mechanism has two problems,
one is that objdump does not account for the offset in that relocation
(only the symbol).  Another is that on an object file (i.e. not a final
executable) the virtual memory address of all sections is zero.  These
combined mean that the vma is miscalculated, and the translation from
vma to symbol is not injective.  In other words: the extra change in
morello-ldst-reloc.d on top of switching the relocation symbols is in
order to account for an objdump bug and not a problem with this gas
change.
gas/config/tc-aarch64.c
gas/testsuite/gas/aarch64/morello-ldst-reloc.d
gas/testsuite/gas/aarch64/reloc-insn.d