]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix HI16 and HI16_S relocations for PR14258
authorNick Clifton <nickc@redhat.com>
Sat, 6 Dec 1997 00:57:20 +0000 (00:57 +0000)
committerNick Clifton <nickc@redhat.com>
Sat, 6 Dec 1997 00:57:20 +0000 (00:57 +0000)
bfd/ChangeLog
bfd/elf32-v850.c

index cd186c666c9ed15ccc530f0d24fbec4f4cd3dacf..6365a57d0179e3c2d6b8bad3af98d6c7b72c33c3 100644 (file)
@@ -6,6 +6,8 @@ Fri Dec  5 11:13:46 1997  Nick Clifton  <nickc@cygnus.com>
        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  <nickc@cygnus.com>
 
index 8e5acf68d1b5e6c4618e01c20ea21c3f25359e4a..36fc38de8557986e888cee555ca3d309a66396fc 100644 (file)
@@ -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);