Skip to content

Commit 509dbc2

Browse files
MIPS/BFD: Use helper function for LO relocation sign-extension
A calculation for LO relocations has been recently fixed with commit ce08b3b ("MIPS/BFD: Fix RELA handling of borrow in the generic linker"), however it was missed that for the updated arithmetic we already have a helper function available, `_bfd_mips_elf_sign_extend'. Replace the open-coded statement then with an equivalent call to said function. No functional change.
1 parent 31b86e2 commit 509dbc2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

bfd/elfxx-mips.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2605,7 +2605,7 @@ _bfd_mips_elf_lo16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
26052605
and we want to apply (symbol + addend + 0x8000) >> 16 to the
26062606
high insn (the +0x8000 adjusting for when the applied low part is
26072607
negative). */
2608-
vallo = ((bfd_get_32 (abfd, location) & 0xffff) ^ 0x8000) - 0x8000;
2608+
vallo = _bfd_mips_elf_sign_extend (bfd_get_32 (abfd, location) & 0xffff, 16);
26092609
_bfd_mips_elf_reloc_shuffle (abfd, reloc_entry->howto->type, false,
26102610
location);
26112611

0 commit comments

Comments
 (0)