Fix HI16 and HI16_S relocations for PR14258

This commit is contained in:
Nick Clifton 1997-12-06 00:57:20 +00:00
parent e0f7db023d
commit 0a5875fc63
2 changed files with 6 additions and 4 deletions

View 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>

View 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);