aboutsummaryrefslogtreecommitdiff
path: root/bfd/bfd.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2022-03-23 08:43:13 +0100
committerJan Beulich <jbeulich@suse.com>2022-03-23 08:43:13 +0100
commit36e2d65d26622e83fa4c3af8289f6728376b9e89 (patch)
tree06c5338662f8a1f490014ef13c8161aafe39048a /bfd/bfd.c
parentb3446f947bd16a0e2a211343d076c36e4de68a2c (diff)
downloadbinutils-36e2d65d26622e83fa4c3af8289f6728376b9e89.zip
binutils-36e2d65d26622e83fa4c3af8289f6728376b9e89.tar.gz
binutils-36e2d65d26622e83fa4c3af8289f6728376b9e89.tar.bz2
ELF32: don't silently truncate relocation addends
At least x86-64's x32 sub-mode and RISC-V's 32-bit mode calculate addends as 64-bit values, but store them in signed 32-bit fields when generating the file without encountering any earlier error. When the relocated field is a 64-bit one, the value resulting after processing the relocation record when linking (or the latest when loading) may thus be wrong due to the truncation. With the code change in place, one x32 testcase actually triggers the new diagnostic. That one case of too large a (negative) addend is being adjusted alongside the addition of a new testcase to actually trigger the new error. (Note that due to internal BFD behavior the relocation in .data doesn't get processed anymore after the errors in .text.) Note that in principle it is possible to express 64-bit relocations in ELF32, but this would require .rel relocations, i.e. with the addend stored in the 64-bit field being relocated. But I guess it would be a lot of effort for little gain to actually support this.
Diffstat (limited to 'bfd/bfd.c')
0 files changed, 0 insertions, 0 deletions