X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=ld%2Fplugin.c;h=173aa1d07180636e8578f5c61555cebcb5d0e18e;hb=d546b61084cec687e0063b2e0e169b4690341c23;hp=60beacd06276c292312aede9f3c78e301ce5663f;hpb=607b483327fdfc75fb193870b3c4e7445ce3f64d;p=deliverable%2Fbinutils-gdb.git diff --git a/ld/plugin.c b/ld/plugin.c index 60beacd062..173aa1d071 100644 --- a/ld/plugin.c +++ b/ld/plugin.c @@ -1,5 +1,5 @@ /* Plugin control for the GNU linker. - Copyright (C) 2010-2020 Free Software Foundation, Inc. + Copyright (C) 2010-2021 Free Software Foundation, Inc. This file is part of the GNU Binutils. @@ -21,6 +21,7 @@ #include "sysdep.h" #include "libiberty.h" #include "bfd.h" +#if BFD_SUPPORTS_PLUGINS #include "bfdlink.h" #include "bfdver.h" #include "ctf-api.h" @@ -414,7 +415,7 @@ asymbol_from_plugin_symbol (bfd *abfd, asymbol *asym, if (bfd_get_flavour (abfd) == bfd_target_elf_flavour) { - elf_symbol_type *elfsym = elf_symbol_from (abfd, asym); + elf_symbol_type *elfsym = elf_symbol_from (asym); unsigned char visibility; if (!elfsym) @@ -1432,12 +1433,18 @@ plugin_notice (struct bfd_link_info *info, new value from a real BFD. Weak symbols are not normally overridden by a new weak definition, and strong symbols will normally cause multiple definition errors. Avoid - this by making the symbol appear to be undefined. */ - else if (((h->type == bfd_link_hash_defweak - || h->type == bfd_link_hash_defined) - && is_ir_dummy_bfd (sym_bfd = h->u.def.section->owner)) - || (h->type == bfd_link_hash_common - && is_ir_dummy_bfd (sym_bfd = h->u.c.p->section->owner))) + this by making the symbol appear to be undefined. + + NB: We change the previous definition in the IR object to + undefweak only after all LTO symbols have been read or for + non-ELF targets. */ + else if ((info->lto_all_symbols_read + || bfd_get_flavour (abfd) != bfd_target_elf_flavour) + && (((h->type == bfd_link_hash_defweak + || h->type == bfd_link_hash_defined) + && is_ir_dummy_bfd (sym_bfd = h->u.def.section->owner)) + || (h->type == bfd_link_hash_common + && is_ir_dummy_bfd (sym_bfd = h->u.c.p->section->owner)))) { h->type = bfd_link_hash_undefweak; h->u.undef.abfd = sym_bfd; @@ -1462,3 +1469,4 @@ plugin_notice (struct bfd_link_info *info, abfd, section, value, flags); return TRUE; } +#endif /* BFD_SUPPORTS_PLUGINS */