mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-24 20:28:28 +08:00
* elflink.h (elf_link_input_bfd): Don't zero discarded link-once
section sym values. Instead replace any relocs against them with relocs against STN_UNDEF, which has a zero value.
This commit is contained in:
@ -1,5 +1,9 @@
|
|||||||
2001-10-06 Alan Modra <amodra@bigpond.net.au>
|
2001-10-06 Alan Modra <amodra@bigpond.net.au>
|
||||||
|
|
||||||
|
* elflink.h (elf_link_input_bfd): Don't zero discarded link-once
|
||||||
|
section sym values. Instead replace any relocs against them with
|
||||||
|
relocs against STN_UNDEF, which has a zero value.
|
||||||
|
|
||||||
* elf32-arc.c (elf_arc_howto_table): Set partial_inplace for all
|
* elf32-arc.c (elf_arc_howto_table): Set partial_inplace for all
|
||||||
relocs.
|
relocs.
|
||||||
|
|
||||||
|
@ -5993,20 +5993,6 @@ elf_link_input_bfd (finfo, input_bfd)
|
|||||||
|
|
||||||
if (ELF_ST_TYPE (isym->st_info) == STT_SECTION)
|
if (ELF_ST_TYPE (isym->st_info) == STT_SECTION)
|
||||||
{
|
{
|
||||||
/* If this is a discarded link-once section symbol, set its
|
|
||||||
value to 0. We should really undefine it, and complain
|
|
||||||
if anything in the final link tries to use it, but
|
|
||||||
DWARF-based exception handling might have an entry in
|
|
||||||
.eh_frame to describe a routine in the linkonce section,
|
|
||||||
and it turns out to be hard to remove the .eh_frame entry
|
|
||||||
too. FIXME. */
|
|
||||||
if (isec != NULL
|
|
||||||
&& (bfd_get_section_flags (input_bfd, isec) & SEC_LINK_ONCE) != 0
|
|
||||||
&& bfd_is_abs_section (isec->output_section))
|
|
||||||
{
|
|
||||||
isym->st_value = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We never output section symbols. Instead, we use the
|
/* We never output section symbols. Instead, we use the
|
||||||
section symbol of the corresponding section in the output
|
section symbol of the corresponding section in the output
|
||||||
file. */
|
file. */
|
||||||
@ -6130,6 +6116,54 @@ elf_link_input_bfd (finfo, input_bfd)
|
|||||||
&& o->reloc_count > 0)
|
&& o->reloc_count > 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
#if BFD_VERSION_DATE < 20031005
|
||||||
|
{
|
||||||
|
Elf_Internal_Rela *rel, *relend;
|
||||||
|
/* Run through the relocs looking for any against section
|
||||||
|
symbols from removed link-once sections. Set any such
|
||||||
|
relocs to be against 0. We should really complain if
|
||||||
|
anything in the final link tries to use it, but
|
||||||
|
DWARF-based exception handling might have an entry in
|
||||||
|
.eh_frame to describe a routine in the linkonce section,
|
||||||
|
and it turns out to be hard to remove the .eh_frame entry
|
||||||
|
too. FIXME. */
|
||||||
|
rel = internal_relocs;
|
||||||
|
relend = rel + o->reloc_count * bed->s->int_rels_per_ext_rel;
|
||||||
|
for ( ; rel < relend; rel++)
|
||||||
|
{
|
||||||
|
unsigned long r_symndx = ELF_R_SYM (rel->r_info);
|
||||||
|
|
||||||
|
if (r_symndx < locsymcount
|
||||||
|
&& (!elf_bad_symtab (input_bfd)
|
||||||
|
|| finfo->sections[r_symndx] != NULL))
|
||||||
|
{
|
||||||
|
isym = finfo->internal_syms + r_symndx;
|
||||||
|
if (ELF_ST_TYPE (isym->st_info) == STT_SECTION)
|
||||||
|
{
|
||||||
|
asection *sec = finfo->sections[r_symndx];
|
||||||
|
|
||||||
|
if (sec != NULL
|
||||||
|
&& (sec->flags & SEC_LINK_ONCE) != 0
|
||||||
|
&& bfd_is_abs_section (sec->output_section))
|
||||||
|
{
|
||||||
|
long r_type = ELF_R_TYPE (rel->r_info);
|
||||||
|
rel->r_info = ELF_R_INFO (0, r_type);
|
||||||
|
|
||||||
|
#if BFD_VERSION_DATE > 20021005
|
||||||
|
(*finfo->info->callbacks->warning)
|
||||||
|
(finfo->info,
|
||||||
|
_("warning: relocation against removed section; zeroing"),
|
||||||
|
NULL, input_bfd, o, rel->r_offset);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#error "This kludge ought to be fixed properly in gcc by now"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Relocate the section by invoking a back end routine.
|
/* Relocate the section by invoking a back end routine.
|
||||||
|
|
||||||
The back end routine is responsible for adjusting the
|
The back end routine is responsible for adjusting the
|
||||||
|
Reference in New Issue
Block a user