aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-mips-elf
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2023-10-19 08:51:47 +1030
committerAlan Modra <amodra@gmail.com>2023-12-11 10:42:59 +1030
commit7fcc471ca223871e5d11ab7bc19be33c2d178ef8 (patch)
tree9da92fbab7926dbd886d5a4fa0a428314dbc31f3 /ld/testsuite/ld-mips-elf
parent811cc76ba3e4d6fb7e17b4d9838c16b2c8ec7911 (diff)
downloadfsf-binutils-gdb-7fcc471ca223871e5d11ab7bc19be33c2d178ef8.zip
fsf-binutils-gdb-7fcc471ca223871e5d11ab7bc19be33c2d178ef8.tar.gz
fsf-binutils-gdb-7fcc471ca223871e5d11ab7bc19be33c2d178ef8.tar.bz2
R_MICROMIPS_GPREL7_S2
This reloc is meant for the 16-bit LWGP instruction, 0x6400/0xfc00 match/mask encoding in `micromips_opcodes'. It is correctly specified to operate on a half-word by the howtos in elf32-mips.c, elfn32-mips.c and elf64-mips.c, but is incorrectly subject to shuffle/unshuffle in code like _bfd_mips_elf32_gprel16_reloc. Current behaviour when applying the reloc to .byte 0x11,0x22,0x33,0x44 is to apply the reloc to byte 0x22 when big-endian, and to byte 0x33 when little-endian. Big-endian behaviour is unchanged after this patch and little-endian correctly applies the reloc to byte 0x11. The patch also corrects REL addend extraction from section contents, and overflow checking. gold had all of the bfd problems with this reloc and additionally did not apply the rightshift by two. bfd/ * elfxx-mips.c (micromips_reloc_shuffle_p): Return false for R_MICROMIPS_GPREL7_S2. (mips_elf_calculate_relocation): Correct sign extension and overflow calculation for R_MICROMIPS_GPREL7_S2. (_bfd_mips_elf_relocate_section): Update small-data overflow message. gold/ * mips.cc (Mips_relocate_functions::should_shuffle_micromips_reloc): Return false for R_MICROMIPS_GPREL7_S2. (Mips_relocate_functions::mips_reloc_unshuffle): Update comment. (Mips_relocate_functions::relgprel): Remove R_MICROMIPS_GPREL7_S2 handling. (Mips_relocate_functions::relgprel7): New function. (Target_mips::Relocate::relocate): Adjust to suit. ld/ * testsuite/ld-mips-elf/reloc-4.d: Adjust expected error. * testsuite/ld-mips-elf/reloc-5.d: Likewise.
Diffstat (limited to 'ld/testsuite/ld-mips-elf')
-rw-r--r--ld/testsuite/ld-mips-elf/reloc-4.d2
-rw-r--r--ld/testsuite/ld-mips-elf/reloc-5.d2
2 files changed, 2 insertions, 2 deletions
diff --git a/ld/testsuite/ld-mips-elf/reloc-4.d b/ld/testsuite/ld-mips-elf/reloc-4.d
index 936a861..3d0a37a 100644
--- a/ld/testsuite/ld-mips-elf/reloc-4.d
+++ b/ld/testsuite/ld-mips-elf/reloc-4.d
@@ -1,3 +1,3 @@
#source: reloc-4.s
#ld:
-#error: small-data section exceeds 64KB.*truncated to fit: R_MIPS_LITERAL
+#error: small-data section too large.*truncated to fit: R_MIPS_LITERAL
diff --git a/ld/testsuite/ld-mips-elf/reloc-5.d b/ld/testsuite/ld-mips-elf/reloc-5.d
index 2fc74ea..7910b35 100644
--- a/ld/testsuite/ld-mips-elf/reloc-5.d
+++ b/ld/testsuite/ld-mips-elf/reloc-5.d
@@ -1,3 +1,3 @@
#source: reloc-5.s
#ld:
-#error: small-data section exceeds 64KB.*truncated to fit: R_MIPS_GPREL16
+#error: small-data section too large.*truncated to fit: R_MIPS_GPREL16