mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-25 13:27:26 +08:00
Fix segfault in ARC linker when generating got entries for local symbols.
bfd * arc-got.h (relocate_fix_got_relocs_for_got_info): Handle the case where there's no elf_link_hash_entry while processing GOT_NORMAL got entries. ld * testsuite/ld-arc/got-01.d: New file. * testsuite/ld-arc/got-01.s: New file.
This commit is contained in:

committed by
Nick Clifton

parent
70ad8739d8
commit
c02d11a585
@ -1,3 +1,9 @@
|
|||||||
|
2016-07-22 Cupertino Miranda <cmiranda@synopsys.com>
|
||||||
|
|
||||||
|
* arc-got.h (relocate_fix_got_relocs_for_got_info): Handle the
|
||||||
|
case where there's no elf_link_hash_entry while processing
|
||||||
|
GOT_NORMAL got entries.
|
||||||
|
|
||||||
2016-07-21 H.J. Lu <hongjiu.lu@intel.com>
|
2016-07-21 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
* version.m4 (BFD_VERSION): Set to 2.27.51.
|
* version.m4 (BFD_VERSION): Set to 2.27.51.
|
||||||
|
@ -369,22 +369,8 @@ relocate_fix_got_relocs_for_got_info (struct got_entry ** list_p,
|
|||||||
= reloc_data->sym_section->output_section->vma
|
= reloc_data->sym_section->output_section->vma
|
||||||
+ reloc_data->sym_section->output_offset;
|
+ reloc_data->sym_section->output_offset;
|
||||||
|
|
||||||
if (h->root.type != bfd_link_hash_undefweak)
|
if (h != NULL
|
||||||
{
|
&& h->root.type == bfd_link_hash_undefweak)
|
||||||
bfd_put_32 (output_bfd,
|
|
||||||
reloc_data->sym_value + sec_vma,
|
|
||||||
htab->sgot->contents + entry->offset);
|
|
||||||
|
|
||||||
ARC_DEBUG ("arc_info: PATCHED: %#08lx "
|
|
||||||
"@ %#08lx for sym %s in got offset %#lx\n",
|
|
||||||
(long) (reloc_data->sym_value + sec_vma),
|
|
||||||
(long) (htab->sgot->output_section->vma
|
|
||||||
+ htab->sgot->output_offset + entry->offset),
|
|
||||||
symbol_name,
|
|
||||||
(long) entry->offset);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ARC_DEBUG ("arc_info: PATCHED: NOT_PATCHED "
|
ARC_DEBUG ("arc_info: PATCHED: NOT_PATCHED "
|
||||||
"@ %#08lx for sym %s in got offset %#lx "
|
"@ %#08lx for sym %s in got offset %#lx "
|
||||||
"(is undefweak)\n",
|
"(is undefweak)\n",
|
||||||
@ -393,6 +379,18 @@ relocate_fix_got_relocs_for_got_info (struct got_entry ** list_p,
|
|||||||
+ entry->offset),
|
+ entry->offset),
|
||||||
symbol_name,
|
symbol_name,
|
||||||
(long) entry->offset);
|
(long) entry->offset);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bfd_put_32 (output_bfd,
|
||||||
|
reloc_data->sym_value + sec_vma,
|
||||||
|
htab->sgot->contents + entry->offset);
|
||||||
|
ARC_DEBUG ("arc_info: PATCHED: %#08lx "
|
||||||
|
"@ %#08lx for sym %s in got offset %#lx\n",
|
||||||
|
(long) (reloc_data->sym_value + sec_vma),
|
||||||
|
(long) (htab->sgot->output_section->vma
|
||||||
|
+ htab->sgot->output_offset + entry->offset),
|
||||||
|
symbol_name,
|
||||||
|
(long) entry->offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2016-07-22 Cupertino Miranda <cmiranda@synopsys.com>
|
||||||
|
|
||||||
|
* testsuite/ld-arc/got-01.d: New file.
|
||||||
|
* testsuite/ld-arc/got-01.s: New file.
|
||||||
|
|
||||||
2016-07-21 H.J. Lu <hongjiu.lu@intel.com>
|
2016-07-21 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
* configure: Regenerated.
|
* configure: Regenerated.
|
||||||
|
7
ld/testsuite/ld-arc/got-01.d
Normal file
7
ld/testsuite/ld-arc/got-01.d
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#source: got-01.s
|
||||||
|
#as: -mcpu=arc700
|
||||||
|
#ld:
|
||||||
|
#readelf: -S
|
||||||
|
|
||||||
|
There are . section headers, starting at offset 0x[0-9a-f]+:
|
||||||
|
#...
|
5
ld/testsuite/ld-arc/got-01.s
Normal file
5
ld/testsuite/ld-arc/got-01.s
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
.text
|
||||||
|
.global __start
|
||||||
|
__start:
|
||||||
|
foo:
|
||||||
|
ld r0, [pcl, foo@gotpc]
|
Reference in New Issue
Block a user