mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-23 11:39:26 +08:00
ELF/LD: Always consider STB_LOCAL symbols local
Do not require forced local (STB_LOCAL) symbols to have a definition in a regular file to be considered to resolve local to the current module, matching `elf_link_renumber_local_hash_table_dynsyms'. In the absence of a regular definition any reference to a STB_LOCAL symbol will have to be garbage collected along with the undefined symbol itself, or the link will eventually fail. Either way the symbol concerned is not going to be external. bfd/ * elflink.c (_bfd_elf_symbol_refs_local_p): Always return TRUE if forced local.
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
2017-04-20 Maciej W. Rozycki <macro@imgtec.com>
|
||||||
|
|
||||||
|
* elflink.c (_bfd_elf_symbol_refs_local_p): Always return TRUE
|
||||||
|
if forced local.
|
||||||
|
|
||||||
2017-04-20 Maciej W. Rozycki <macro@imgtec.com>
|
2017-04-20 Maciej W. Rozycki <macro@imgtec.com>
|
||||||
|
|
||||||
* elfxx-mips.c (_bfd_mips_elf_final_link): Reorder comment about
|
* elfxx-mips.c (_bfd_mips_elf_final_link): Reorder comment about
|
||||||
|
@ -3063,10 +3063,10 @@ _bfd_elf_dynamic_symbol_p (struct elf_link_hash_entry *h,
|
|||||||
to resolve local to the current module, and false otherwise. Differs
|
to resolve local to the current module, and false otherwise. Differs
|
||||||
from (the inverse of) _bfd_elf_dynamic_symbol_p in the treatment of
|
from (the inverse of) _bfd_elf_dynamic_symbol_p in the treatment of
|
||||||
undefined symbols. The two functions are virtually identical except
|
undefined symbols. The two functions are virtually identical except
|
||||||
for the place where forced_local and dynindx == -1 are tested. If
|
for the place where dynindx == -1 is tested. If that test is true,
|
||||||
either of those tests are true, _bfd_elf_dynamic_symbol_p will say
|
_bfd_elf_dynamic_symbol_p will say the symbol is local, while
|
||||||
the symbol is local, while _bfd_elf_symbol_refs_local_p will say
|
_bfd_elf_symbol_refs_local_p will say the symbol is local only for
|
||||||
the symbol is local only for defined symbols.
|
defined symbols.
|
||||||
It might seem that _bfd_elf_dynamic_symbol_p could be rewritten as
|
It might seem that _bfd_elf_dynamic_symbol_p could be rewritten as
|
||||||
!_bfd_elf_symbol_refs_local_p, except that targets differ in their
|
!_bfd_elf_symbol_refs_local_p, except that targets differ in their
|
||||||
treatment of undefined weak symbols. For those that do not make
|
treatment of undefined weak symbols. For those that do not make
|
||||||
@ -3089,6 +3089,10 @@ _bfd_elf_symbol_refs_local_p (struct elf_link_hash_entry *h,
|
|||||||
|| ELF_ST_VISIBILITY (h->other) == STV_INTERNAL)
|
|| ELF_ST_VISIBILITY (h->other) == STV_INTERNAL)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
/* Forced local symbols resolve locally. */
|
||||||
|
if (h->forced_local)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
/* Common symbols that become definitions don't get the DEF_REGULAR
|
/* Common symbols that become definitions don't get the DEF_REGULAR
|
||||||
flag set, so test it first, and don't bail out. */
|
flag set, so test it first, and don't bail out. */
|
||||||
if (ELF_COMMON_DEF_P (h))
|
if (ELF_COMMON_DEF_P (h))
|
||||||
@ -3098,11 +3102,7 @@ _bfd_elf_symbol_refs_local_p (struct elf_link_hash_entry *h,
|
|||||||
else if (!h->def_regular)
|
else if (!h->def_regular)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* Forced local symbols resolve locally. */
|
/* Non-dynamic symbols resolve locally. */
|
||||||
if (h->forced_local)
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
/* As do non-dynamic symbols. */
|
|
||||||
if (h->dynindx == -1)
|
if (h->dynindx == -1)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user