[committed] MIPS/BFD: Fix rightshift for remaining n32 reloc howtos
Maciej W. Rozycki
macro@orcam.me.uk
Mon Oct 6 20:45:56 GMT 2025
Correct the rightshift amount for the R_MIPS_HIGHER, R_MIPS_HIGHEST and
R_MIPS_CALL_HI16 RELA relocation howtos, missed with commit f38e9921479a
("MIPS HI16 and LO16 reloc howtos").
---
Not that it matters in reality. The rightshift amount with these howtos,
being of the RELA type, is only used by the generic linker, so for output
such as srec. Then R_MIPS_HIGHER/R_MIPS_HIGHEST are not supposed to be
used with n32, which uses 32-bit addressing, but let's keep their removal
for another occasion. And R_MIPS_CALL_HI16 is used with SVR4 PIC, which,
ahem, cannot produce useful non-ELF output. Applied for correctness only.
---
bfd/elfn32-mips.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
binutils-mips-bfd-n32-reloc-rightshift.diff
Index: binutils-gdb/bfd/elfn32-mips.c
===================================================================
--- binutils-gdb.orig/bfd/elfn32-mips.c
+++ binutils-gdb/bfd/elfn32-mips.c
@@ -1264,7 +1264,7 @@ static reloc_howto_type elf_mips_howto_t
/* Get the higher value of a 64 bit addend. */
HOWTO (R_MIPS_HIGHER, /* type */
- 0, /* rightshift */
+ 32, /* rightshift */
4, /* size */
16, /* bitsize */
false, /* pc_relative */
@@ -1279,7 +1279,7 @@ static reloc_howto_type elf_mips_howto_t
/* Get the highest value of a 64 bit addend. */
HOWTO (R_MIPS_HIGHEST, /* type */
- 0, /* rightshift */
+ 48, /* rightshift */
4, /* size */
16, /* bitsize */
false, /* pc_relative */
@@ -1294,7 +1294,7 @@ static reloc_howto_type elf_mips_howto_t
/* High 16 bits of displacement in global offset table. */
HOWTO (R_MIPS_CALL_HI16, /* type */
- 0, /* rightshift */
+ 16, /* rightshift */
4, /* size */
16, /* bitsize */
false, /* pc_relative */
More information about the Binutils
mailing list