mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-20 01:50:24 +08:00
Correct the generation of OR1K pc-relative relocations.
gas PR ld/18759 * config/tc-or1k.c (tc_gen_reloc): Correct computation of PC relative relocs. * config/tc-or1k.h (GAS_CGEN_PRCEL_R_TYPE): Delete. bfd * elf32-or1k.c (R_OR1K_32_PCREL): Set pcrel_offset to TRUE. (R_OR1K_16_PCREL): Likewise. (R_OR1K_8_PCREL): Likewise. ld/tests * ld-elf/eh-frame-hdr: Expect to pass on the or1k-linux target.
This commit is contained in:

committed by
Nick Clifton

parent
6cd8405efd
commit
8a9e7a9121
@ -1,3 +1,10 @@
|
|||||||
|
2015-08-11 Peter Zotov <whitequark@whitequark.org>
|
||||||
|
|
||||||
|
PR ld/18759
|
||||||
|
* elf32-or1k.c (R_OR1K_32_PCREL): Set pcrel_offset to TRUE.
|
||||||
|
(R_OR1K_16_PCREL): Likewise.
|
||||||
|
(R_OR1K_8_PCREL): Likewise.
|
||||||
|
|
||||||
2015-09-23 Nick Clifton <nickc@redhat.com>
|
2015-09-23 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
* bout.c (b_out_slurp_reloc_table): Cast constant to unsigned in
|
* bout.c (b_out_slurp_reloc_table): Cast constant to unsigned in
|
||||||
|
@ -199,7 +199,7 @@ static reloc_howto_type or1k_elf_howto_table[] =
|
|||||||
FALSE, /* partial_inplace */
|
FALSE, /* partial_inplace */
|
||||||
0, /* src_mask */
|
0, /* src_mask */
|
||||||
0xffffffff, /* dst_mask */
|
0xffffffff, /* dst_mask */
|
||||||
FALSE), /* pcrel_offset */
|
TRUE), /* pcrel_offset */
|
||||||
|
|
||||||
HOWTO (R_OR1K_16_PCREL,
|
HOWTO (R_OR1K_16_PCREL,
|
||||||
0, /* rightshift */
|
0, /* rightshift */
|
||||||
@ -213,7 +213,7 @@ static reloc_howto_type or1k_elf_howto_table[] =
|
|||||||
FALSE, /* partial_inplace */
|
FALSE, /* partial_inplace */
|
||||||
0, /* src_mask */
|
0, /* src_mask */
|
||||||
0xffff, /* dst_mask */
|
0xffff, /* dst_mask */
|
||||||
FALSE), /* pcrel_offset */
|
TRUE), /* pcrel_offset */
|
||||||
|
|
||||||
HOWTO (R_OR1K_8_PCREL,
|
HOWTO (R_OR1K_8_PCREL,
|
||||||
0, /* rightshift */
|
0, /* rightshift */
|
||||||
@ -227,7 +227,7 @@ static reloc_howto_type or1k_elf_howto_table[] =
|
|||||||
FALSE, /* partial_inplace */
|
FALSE, /* partial_inplace */
|
||||||
0, /* src_mask */
|
0, /* src_mask */
|
||||||
0xff, /* dst_mask */
|
0xff, /* dst_mask */
|
||||||
FALSE), /* pcrel_offset */
|
TRUE), /* pcrel_offset */
|
||||||
|
|
||||||
HOWTO (R_OR1K_GOTPC_HI16, /* Type. */
|
HOWTO (R_OR1K_GOTPC_HI16, /* Type. */
|
||||||
16, /* Rightshift. */
|
16, /* Rightshift. */
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
2015-08-11 Peter Zotov <whitequark@whitequark.org>
|
||||||
|
|
||||||
|
PR ld/18759
|
||||||
|
* config/tc-or1k.c (tc_gen_reloc): Correct computation of PC
|
||||||
|
relative relocs.
|
||||||
|
* config/tc-or1k.h (GAS_CGEN_PRCEL_R_TYPE): Delete.
|
||||||
|
|
||||||
2015-09-25 Ryo ONODERA <ryo_on@yk.rim.or.jp>
|
2015-09-25 Ryo ONODERA <ryo_on@yk.rim.or.jp>
|
||||||
|
|
||||||
PR 18994
|
PR 18994
|
||||||
|
@ -298,27 +298,59 @@ or1k_fix_adjustable (fixS * fixP)
|
|||||||
#define GOT_NAME "_GLOBAL_OFFSET_TABLE_"
|
#define GOT_NAME "_GLOBAL_OFFSET_TABLE_"
|
||||||
|
|
||||||
arelent *
|
arelent *
|
||||||
tc_gen_reloc (asection *sec, fixS *fx)
|
tc_gen_reloc (asection * section, fixS * fixp)
|
||||||
{
|
{
|
||||||
bfd_reloc_code_real_type code = fx->fx_r_type;
|
arelent *reloc;
|
||||||
|
bfd_reloc_code_real_type code;
|
||||||
|
|
||||||
if (fx->fx_addsy != NULL
|
reloc = xmalloc (sizeof (arelent));
|
||||||
&& strcmp (S_GET_NAME (fx->fx_addsy), GOT_NAME) == 0
|
|
||||||
&& (code == BFD_RELOC_OR1K_GOTPC_HI16
|
reloc->sym_ptr_ptr = xmalloc (sizeof (asymbol *));
|
||||||
|| code == BFD_RELOC_OR1K_GOTPC_LO16))
|
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
|
||||||
|
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
|
||||||
|
|
||||||
|
if (fixp->fx_pcrel)
|
||||||
{
|
{
|
||||||
arelent * reloc;
|
if (section->use_rela_p)
|
||||||
|
fixp->fx_offset -= md_pcrel_from_section (fixp, section);
|
||||||
|
else
|
||||||
|
fixp->fx_offset = reloc->address;
|
||||||
|
}
|
||||||
|
reloc->addend = fixp->fx_offset;
|
||||||
|
|
||||||
reloc = xmalloc (sizeof (* reloc));
|
code = fixp->fx_r_type;
|
||||||
reloc->sym_ptr_ptr = xmalloc (sizeof (asymbol *));
|
switch (code)
|
||||||
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fx->fx_addsy);
|
{
|
||||||
reloc->address = fx->fx_frag->fr_address + fx->fx_where;
|
case BFD_RELOC_16:
|
||||||
reloc->howto = bfd_reloc_type_lookup (stdoutput, fx->fx_r_type);
|
if (fixp->fx_pcrel)
|
||||||
reloc->addend = fx->fx_offset;
|
code = BFD_RELOC_16_PCREL;
|
||||||
return reloc;
|
break;
|
||||||
|
|
||||||
|
case BFD_RELOC_32:
|
||||||
|
if (fixp->fx_pcrel)
|
||||||
|
code = BFD_RELOC_32_PCREL;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BFD_RELOC_64:
|
||||||
|
if (fixp->fx_pcrel)
|
||||||
|
code = BFD_RELOC_64_PCREL;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return gas_cgen_tc_gen_reloc (sec, fx);
|
reloc->howto = bfd_reloc_type_lookup (stdoutput, code);
|
||||||
|
if (reloc->howto == NULL)
|
||||||
|
{
|
||||||
|
as_bad_where (fixp->fx_file, fixp->fx_line,
|
||||||
|
_
|
||||||
|
("cannot represent %s relocation in this object file format"),
|
||||||
|
bfd_get_reloc_code_name (code));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return reloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -57,8 +57,6 @@ extern long md_pcrel_from_section (struct fix *, segT);
|
|||||||
extern const struct relax_type md_relax_table[];
|
extern const struct relax_type md_relax_table[];
|
||||||
#define TC_GENERIC_RELAX_TABLE md_relax_table
|
#define TC_GENERIC_RELAX_TABLE md_relax_table
|
||||||
|
|
||||||
#define GAS_CGEN_PCREL_R_TYPE(r_type) gas_cgen_pcrel_r_type(r_type)
|
|
||||||
|
|
||||||
#define elf_tc_final_processing or1k_elf_final_processing
|
#define elf_tc_final_processing or1k_elf_final_processing
|
||||||
void or1k_elf_final_processing (void);
|
void or1k_elf_final_processing (void);
|
||||||
|
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2015-08-11 Peter Zotov <whitequark@whitequark.org>
|
||||||
|
|
||||||
|
PR ld/18759
|
||||||
|
* ld-elf/eh-frame-hdr: Expect to pass on the or1k-linux target.
|
||||||
|
|
||||||
2015-09-22 H.J. Lu <hongjiu.lu@intel.com>
|
2015-09-22 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
* ld-mips-elf/pie-n32.d: Updated.
|
* ld-mips-elf/pie-n32.d: Updated.
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#ld: -e _start --eh-frame-hdr
|
#ld: -e _start --eh-frame-hdr
|
||||||
#objdump: -hw
|
#objdump: -hw
|
||||||
#target: cfi
|
#target: cfi
|
||||||
#xfail: avr*-*-* or1k-*-* visium-*-*
|
#xfail: avr*-*-* or1k*-*-elf or1k*-*-rtems* visium-*-*
|
||||||
# avr doesn't support shared libraries.
|
# avr doesn't support shared libraries.
|
||||||
#...
|
#...
|
||||||
[0-9] .eh_frame_hdr 0*[12][048c] .*
|
[0-9] .eh_frame_hdr 0*[12][048c] .*
|
||||||
|
Reference in New Issue
Block a user