aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2018-01-23 10:50:02 +1030
committerAlan Modra <amodra@gmail.com>2018-01-26 13:52:07 +1030
commit32253bb7963ac7caa166ec41e336372f2ffc03d4 (patch)
treefd2623c3a02a407f5123e0d62ab1c02d7f1afcf3
parentba21f5646454c418e75eb06f6bf1a00a173641ca (diff)
downloadgdb-32253bb7963ac7caa166ec41e336372f2ffc03d4.zip
gdb-32253bb7963ac7caa166ec41e336372f2ffc03d4.tar.gz
gdb-32253bb7963ac7caa166ec41e336372f2ffc03d4.tar.bz2
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.
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elflink.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 4ad0127..2eb4916 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,10 @@
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
.branch_lt changes size.
diff --git a/bfd/elflink.c b/bfd/elflink.c
index e3751fa..e81f6c6 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -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;