version 1.1.1.4, 2020/04/03 17:41:10 |
version 1.1.1.5, 2022/12/23 17:01:22 |
|
|
/* BFD back-end for Renesas Super-H COFF binaries. |
/* BFD back-end for Renesas Super-H COFF binaries. |
Copyright (C) 1993-2018 Free Software Foundation, Inc. |
Copyright (C) 1993-2020 Free Software Foundation, Inc. |
Contributed by Cygnus Support. |
Contributed by Cygnus Support. |
Written by Steve Chamberlain, <sac@cygnus.com>. |
Written by Steve Chamberlain, <sac@cygnus.com>. |
Relaxing code written by Ian Lance Taylor, <ian@cygnus.com>. |
Relaxing code written by Ian Lance Taylor, <ian@cygnus.com>. |
Line 567 sh_reloc (bfd * abfd, |
|
Line 567 sh_reloc (bfd * abfd, |
|
bfd * output_bfd, |
bfd * output_bfd, |
char ** error_message ATTRIBUTE_UNUSED) |
char ** error_message ATTRIBUTE_UNUSED) |
{ |
{ |
unsigned long insn; |
bfd_vma insn; |
bfd_vma sym_value; |
bfd_vma sym_value; |
unsigned short r_type; |
unsigned short r_type; |
bfd_vma addr = reloc_entry->address; |
bfd_vma addr = reloc_entry->address; |
Line 610 sh_reloc (bfd * abfd, |
|
Line 610 sh_reloc (bfd * abfd, |
|
#endif |
#endif |
insn = bfd_get_32 (abfd, hit_data); |
insn = bfd_get_32 (abfd, hit_data); |
insn += sym_value + reloc_entry->addend; |
insn += sym_value + reloc_entry->addend; |
bfd_put_32 (abfd, (bfd_vma) insn, hit_data); |
bfd_put_32 (abfd, insn, hit_data); |
break; |
break; |
#ifdef COFF_WITH_PE |
#ifdef COFF_WITH_PE |
case R_SH_IMAGEBASE: |
case R_SH_IMAGEBASE: |
insn = bfd_get_32 (abfd, hit_data); |
insn = bfd_get_32 (abfd, hit_data); |
insn += sym_value + reloc_entry->addend; |
insn += sym_value + reloc_entry->addend; |
insn -= pe_data (input_section->output_section->owner)->pe_opthdr.ImageBase; |
insn -= pe_data (input_section->output_section->owner)->pe_opthdr.ImageBase; |
bfd_put_32 (abfd, (bfd_vma) insn, hit_data); |
bfd_put_32 (abfd, insn, hit_data); |
break; |
break; |
#endif |
#endif |
case R_SH_PCDISP: |
case R_SH_PCDISP: |
Line 627 sh_reloc (bfd * abfd, |
|
Line 627 sh_reloc (bfd * abfd, |
|
+ input_section->output_offset |
+ input_section->output_offset |
+ addr |
+ addr |
+ 4); |
+ 4); |
sym_value += (insn & 0xfff) << 1; |
sym_value += (((insn & 0xfff) ^ 0x800) - 0x800) << 1; |
if (insn & 0x800) |
insn = (insn & 0xf000) | ((sym_value >> 1) & 0xfff); |
sym_value -= 0x1000; |
bfd_put_16 (abfd, insn, hit_data); |
insn = (insn & 0xf000) | (sym_value & 0xfff); |
if (sym_value + 0x1000 >= 0x2000 || (sym_value & 1) != 0) |
bfd_put_16 (abfd, (bfd_vma) insn, hit_data); |
|
if (sym_value < (bfd_vma) -0x1000 || sym_value >= 0x1000) |
|
return bfd_reloc_overflow; |
return bfd_reloc_overflow; |
break; |
break; |
default: |
default: |