diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2015-02-06 04:25:36 -0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2015-02-06 04:29:35 -0800 |
commit | 9e2dec471006de3e0489a34fbeb922fee1e302af (patch) | |
tree | 7ab3bd6dbab46c47b980a09d16592ea6b12326ea /bfd/elflink.c | |
parent | e584fdbc6a9b0da786c5a55855f9fd9f7e676198 (diff) | |
download | gdb-9e2dec471006de3e0489a34fbeb922fee1e302af.zip gdb-9e2dec471006de3e0489a34fbeb922fee1e302af.tar.gz gdb-9e2dec471006de3e0489a34fbeb922fee1e302af.tar.bz2 |
Properly mark the plugin symbol undefined
Mark the unused plugin defined symbol in elf_link_input_bfd instead of
_bfd_elf_fix_symbol_flags. Limit the PR ld/12365 test to x86 targets.
bfd/
PR ld/12365
PR ld/14272
* elflink.c (_bfd_elf_fix_symbol_flags): Revert the last change.
(elf_link_input_bfd): Mark the plugin symbol undefined if it is
referenced from a non-IR file.
ld/testsuite/
PR ld/12365
PR ld/14272
* ld-plugin/lto.exp: Run the PR ld/12365 test only for x86 targets.
* ld-plugin/plugin-7.d: Updated.
* ld-plugin/plugin-8.d: Likewise.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r-- | bfd/elflink.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c index 604cfb6..e8c4ad4 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -2423,20 +2423,6 @@ _bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h, } else { - /* If a plugin symbol is referenced from a non-IR file, mark - the symbol as undefined, except for symbol for linker - created section. */ - if (h->root.non_ir_ref - && (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - && (h->root.u.def.section->flags & SEC_LINKER_CREATED) == 0 - && h->root.u.def.section->owner != NULL - && (h->root.u.def.section->owner->flags & BFD_PLUGIN) != 0) - { - h->root.type = bfd_link_hash_undefined; - h->root.u.undef.abfd = h->root.u.def.section->owner; - } - /* Unfortunately, NON_ELF is only correct if the symbol was first seen in a non-ELF file. Fortunately, if the symbol was first seen in an ELF file, we're probably OK unless the @@ -9807,6 +9793,22 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd) s_type = h->type; + /* If a plugin symbol is referenced from a non-IR file, + mark the symbol as undefined, except for symbol for + linker created section. */ + if (h->root.non_ir_ref + && (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + && (h->root.u.def.section->flags + & SEC_LINKER_CREATED) == 0 + && h->root.u.def.section->owner != NULL + && (h->root.u.def.section->owner->flags + & BFD_PLUGIN) != 0) + { + h->root.type = bfd_link_hash_undefined; + h->root.u.undef.abfd = h->root.u.def.section->owner; + } + ps = NULL; if (h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) |