Define __start/__stop symbols when there is only a dynamic def

This patch fixes a case where a user had a C-representable named
section in both the executable and shared libraries, and of course
wanted the size of the local section in the executable, not the
dynamic section.  It does mean that __start and __stop symbols don't
behave exactly like PROVIDEd symbols, but I think that's a reasonable
difference particularly since this is the way they used to behave.

	* elflink.c (bfd_elf_define_start_stop): Override symbols when
	they are defined dynamically.
This commit is contained in:
Alan Modra 2018-01-23 10:50:02 +10:30
parent ba21f56464
commit 32253bb796
2 changed files with 6 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2018-01-26 Alan Modra <amodra@gmail.com>
* elflink.c (bfd_elf_define_start_stop): Override symbols when
they are defined dynamically.
2018-01-26 Alan Modra <amodra@gmail.com>
* elf64-ppc.c (ppc64_elf_size_stubs): Iterate sizing when

View file

@ -14338,7 +14338,7 @@ bfd_elf_define_start_stop (struct bfd_link_info *info,
if (h != NULL
&& (h->root.type == bfd_link_hash_undefined
|| h->root.type == bfd_link_hash_undefweak
|| (h->ref_regular && !h->def_regular)))
|| ((h->ref_regular || h->def_dynamic) && !h->def_regular)))
{
h->root.type = bfd_link_hash_defined;
h->root.u.def.section = sec;