bfd: or1k: avoid emitting R_OR1K_INSN_REL_26 in shared libs
This fixes a bug where R_OR1K_INSN_REL_26 relocations would be emitted into shared libraries even when the referenced symbol was hidden or the symbol was contained in the same .so which had been linked with -Bsymbolic. bfd/ * elf32-or1k.c (or1k_elf_relocate_section, or1k_elf_check_relocs, allocate_dynrelocs): Use SYMBOL_REFERENCES_LOCAL, SYMBOL_CALLS_LOCAL and SYMBOLIC_BIND.
This commit is contained in:
parent
703ec4e8d0
commit
ffccb7afb5
|
@ -1,3 +1,9 @@
|
||||||
|
2014-08-13 Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
|
||||||
|
|
||||||
|
* elf32-or1k.c (or1k_elf_relocate_section, or1k_elf_check_relocs,
|
||||||
|
allocate_dynrelocs): Use SYMBOL_REFERENCES_LOCAL, SYMBOL_CALLS_LOCAL
|
||||||
|
and SYMBOLIC_BIND.
|
||||||
|
|
||||||
2014-08-12 Alan Modra <amodra@gmail.com>
|
2014-08-12 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
* coff-aux.c (coff_m68k_aux_link_add_one_symbol): Only call "notice"
|
* coff-aux.c (coff_m68k_aux_link_add_one_symbol): Only call "notice"
|
||||||
|
|
|
@ -907,10 +907,7 @@ or1k_elf_relocate_section (bfd *output_bfd,
|
||||||
dyn = htab->root.dynamic_sections_created;
|
dyn = htab->root.dynamic_sections_created;
|
||||||
if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
|
if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
|
||||||
|| (info->shared
|
|| (info->shared
|
||||||
&& (info->symbolic
|
&& SYMBOL_REFERENCES_LOCAL (info, h)))
|
||||||
|| h->dynindx == -1
|
|
||||||
|| h->forced_local)
|
|
||||||
&& h->def_regular))
|
|
||||||
{
|
{
|
||||||
/* This is actually a static link, or it is a
|
/* This is actually a static link, or it is a
|
||||||
-Bsymbolic link and the symbol is defined
|
-Bsymbolic link and the symbol is defined
|
||||||
|
@ -1015,11 +1012,8 @@ or1k_elf_relocate_section (bfd *output_bfd,
|
||||||
&& (h == NULL
|
&& (h == NULL
|
||||||
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||||
|| h->root.type != bfd_link_hash_undefweak)
|
|| h->root.type != bfd_link_hash_undefweak)
|
||||||
&& (!howto->pc_relative
|
&& (howto->type != R_OR1K_INSN_REL_26
|
||||||
|| (h != NULL
|
|| !SYMBOL_CALLS_LOCAL (info, h)))
|
||||||
&& h->dynindx != -1
|
|
||||||
&& (!info->symbolic
|
|
||||||
|| !h->def_regular))))
|
|
||||||
|| (!info->shared
|
|| (!info->shared
|
||||||
&& h != NULL
|
&& h != NULL
|
||||||
&& h->dynindx != -1
|
&& h->dynindx != -1
|
||||||
|
@ -1613,7 +1607,7 @@ or1k_elf_check_relocs (bfd *abfd,
|
||||||
&& (sec->flags & SEC_ALLOC) != 0
|
&& (sec->flags & SEC_ALLOC) != 0
|
||||||
&& (ELF32_R_TYPE (rel->r_info) != R_OR1K_INSN_REL_26
|
&& (ELF32_R_TYPE (rel->r_info) != R_OR1K_INSN_REL_26
|
||||||
|| (h != NULL
|
|| (h != NULL
|
||||||
&& (! info->symbolic
|
&& (!SYMBOLIC_BIND (info, h)
|
||||||
|| h->root.type == bfd_link_hash_defweak
|
|| h->root.type == bfd_link_hash_defweak
|
||||||
|| !h->def_regular))))
|
|| !h->def_regular))))
|
||||||
|| (!info->shared
|
|| (!info->shared
|
||||||
|
@ -1991,11 +1985,7 @@ or1k_elf_finish_dynamic_symbol (bfd *output_bfd,
|
||||||
the symbol was forced to be local because of a version file.
|
the symbol was forced to be local because of a version file.
|
||||||
The entry in the global offset table will already have been
|
The entry in the global offset table will already have been
|
||||||
initialized in the relocate_section function. */
|
initialized in the relocate_section function. */
|
||||||
if (info->shared
|
if (info->shared && SYMBOL_REFERENCES_LOCAL (info, h))
|
||||||
&& (info->symbolic
|
|
||||||
|| h->dynindx == -1
|
|
||||||
|| h->forced_local)
|
|
||||||
&& h->def_regular)
|
|
||||||
{
|
{
|
||||||
rela.r_info = ELF32_R_INFO (0, R_OR1K_RELATIVE);
|
rela.r_info = ELF32_R_INFO (0, R_OR1K_RELATIVE);
|
||||||
rela.r_addend = (h->root.u.def.value
|
rela.r_addend = (h->root.u.def.value
|
||||||
|
@ -2327,9 +2317,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
|
||||||
|
|
||||||
if (info->shared)
|
if (info->shared)
|
||||||
{
|
{
|
||||||
if (h->def_regular
|
if (SYMBOL_CALLS_LOCAL (info, h))
|
||||||
&& (h->forced_local
|
|
||||||
|| info->symbolic))
|
|
||||||
{
|
{
|
||||||
struct elf_or1k_dyn_relocs **pp;
|
struct elf_or1k_dyn_relocs **pp;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue