aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2018-12-07 15:39:49 -0800
committerH.J. Lu <hjl.tools@gmail.com>2018-12-07 15:40:02 -0800
commitfbcc8bafeb413a111cd3caab39b3ab57d5b8ce93 (patch)
tree4437adb9b4b852c95fdf3f3b1a841bf3d7ea6a96 /bfd
parentd9c859da9fff9de47a33f52d75a6fef2495b3fc1 (diff)
downloadgdb-fbcc8bafeb413a111cd3caab39b3ab57d5b8ce93.zip
gdb-fbcc8bafeb413a111cd3caab39b3ab57d5b8ce93.tar.gz
gdb-fbcc8bafeb413a111cd3caab39b3ab57d5b8ce93.tar.bz2
Override the previous definition from IR object
Mark the previous definition from IR object as undefined so that the generic linker will override it. bfd/ PR ld/23958 * elflink.c (_bfd_elf_add_default_symbol): Override the previous definition from IR object. ld/ PR ld/23958 * testsuite/ld-plugin/lto.exp: Run PR ld/23958 test. * testsuite/ld-plugin/pr23958.c: New file. * testsuite/ld-plugin/pr23958.t: Likewise.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elflink.c9
2 files changed, 15 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 85277a1..aa8be34 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2018-12-07 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/23958
+ * elflink.c (_bfd_elf_add_default_symbol): Override the previous
+ definition from IR object.
+
2018-12-08 Stafford Horne <shorne@gmail.com>
* elf32-or1k.c (or1k_grok_prstatus): New function.
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 4eca389..8992a50 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -1941,6 +1941,15 @@ _bfd_elf_add_default_symbol (bfd *abfd,
if (! bfd_link_relocatable (info))
{
bh = &hi->root;
+ if (bh->type == bfd_link_hash_defined
+ && (bh->u.def.section->owner->flags & BFD_PLUGIN) != 0)
+ {
+ /* Mark the previous definition from IR object as
+ undefined so that the generic linker will override
+ it. */
+ bh->type = bfd_link_hash_undefined;
+ bh->u.undef.abfd = bh->u.def.section->owner;
+ }
if (! (_bfd_generic_link_add_one_symbol
(info, abfd, shortname, BSF_INDIRECT,
bfd_ind_section_ptr,