is_relocatable_executable --exclude-libs failure

--exclude-libs makes symbols hidden, but that doesn't prevent them
being made dynamic for is_relocatable_executable targets.  Fix that.

	* elflink.c (bfd_elf_link_record_dynamic_symbol): Handle no_export
	for relocatable executable.
This commit is contained in:
Alan Modra 2021-01-05 22:51:42 +10:30
parent d750c713c9
commit c8bad65eee
2 changed files with 11 additions and 1 deletions

View file

@ -534,7 +534,12 @@ bfd_elf_link_record_dynamic_symbol (struct bfd_link_info *info,
&& h->root.type != bfd_link_hash_undefweak)
{
h->forced_local = 1;
if (!elf_hash_table (info)->is_relocatable_executable)
if (!elf_hash_table (info)->is_relocatable_executable
|| ((h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
&& h->root.u.def.section->owner->no_export)
|| (h->root.type == bfd_link_hash_common
&& h->root.u.c.p->section->owner->no_export))
return TRUE;
}