From 0a5875fc63c256f0daa9db6ed9a35257ab3db247 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Sat, 6 Dec 1997 00:57:20 +0000 Subject: [PATCH] Fix HI16 and HI16_S relocations for PR14258 --- bfd/ChangeLog | 2 ++ bfd/elf32-v850.c | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index cd186c666c9..6365a57d017 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -6,6 +6,8 @@ Fri Dec 5 11:13:46 1997 Nick Clifton v850_elf_add_symbol_hook, v850_elf_link_output_symbol_hook, v850_elf_section_from_shdr, v850_elf_fake_sections): New functions (for PR14180) to create and handle special common sections. + (v850_elf_final_link_relocate): Fix HI16 and HI16_S relocations + which have data stored in the instructions. PR14258. Tue Dec 2 10:26:16 1997 Nick Clifton diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c index 8e5acf68d1b..36fc38de855 100644 --- a/bfd/elf32-v850.c +++ b/bfd/elf32-v850.c @@ -691,13 +691,13 @@ v850_elf_store_addend_in_insn (abfd, r_type, addend, address, replace) break; case R_V850_HI16_S: - addend += bfd_get_16 (abfd, address); + addend += (bfd_get_16 (abfd, address) << 16); addend = (addend >> 16) + ((addend & 0x8000) != 0); insn = addend; break; case R_V850_HI16: - addend += bfd_get_16 (abfd, address); + addend += (bfd_get_16 (abfd, address) << 16); addend = (addend >> 16); insn = addend; break; @@ -1009,7 +1009,7 @@ v850_elf_final_link_relocate (howto, input_bfd, output_bfd, return bfd_reloc_ok; case R_V850_HI16_S: - value += (short)bfd_get_16 (input_bfd, hit_data); + value += (bfd_get_16 (input_bfd, hit_data) << 16); value = (value >> 16) + ((value & 0x8000) != 0); if ((long)value > 0x7fff || (long)value < -0x8000) @@ -1023,7 +1023,7 @@ v850_elf_final_link_relocate (howto, input_bfd, output_bfd, return bfd_reloc_ok; case R_V850_HI16: - value += (short)bfd_get_16 (input_bfd, hit_data); + value += (bfd_get_16 (input_bfd, hit_data) << 16); value >>= 16; bfd_put_16 (input_bfd, value, hit_data); -- 2.30.2