summaryrefslogtreecommitdiff
path: root/ld/plugin.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2010-12-06 00:00:12 +0000
committerH.J. Lu <hjl.tools@gmail.com>2010-12-06 00:00:12 +0000
commit11690dc9c8bccb8afa85dff1aa9a9c2281f490ff (patch)
tree0184f8428054affd959c290229bab6567eb785db /ld/plugin.c
parent3f4dc5204b897ac6b2dabcb95cad0e27b321fa59 (diff)
downloadbinutils-redhat-11690dc9c8bccb8afa85dff1aa9a9c2281f490ff.tar.gz
Properly convert LTO plugin visibility to ELF visibility.
ld/ 2010-12-05 H.J. Lu <hongjiu.lu@intel.com> * plugin.c (asymbol_from_plugin_symbol): Properly convert LTO plugin visibility to ELF visibility. (is_visible_from_outside): Re-indent. ld/testsuite/ 2010-12-05 H.J. Lu <hongjiu.lu@intel.com> * ld-plugin/plugin-vis-1.d: Updated.
Diffstat (limited to 'ld/plugin.c')
-rw-r--r--ld/plugin.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/ld/plugin.c b/ld/plugin.c
index 6afc14baba..ae9c378c1a 100644
--- a/ld/plugin.c
+++ b/ld/plugin.c
@@ -307,10 +307,31 @@ 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);
+ unsigned char visibility;
+
if (!elfsym)
einfo (_("%P%F: %s: non-ELF symbol in ELF BFD!"), asym->name);
- elfsym->internal_elf_sym.st_other &= ~3;
- elfsym->internal_elf_sym.st_other |= ldsym->visibility;
+ switch (ldsym->visibility)
+ {
+ default:
+ einfo (_("%P%F: unknown ELF symbol visibility: %d!"),
+ ldsym->visibility);
+ case LDPV_DEFAULT:
+ visibility = STV_DEFAULT;
+ break;
+ case LDPV_PROTECTED:
+ visibility = STV_PROTECTED;
+ break;
+ case LDPV_INTERNAL:
+ visibility = STV_INTERNAL;
+ break;
+ case LDPV_HIDDEN:
+ visibility = STV_HIDDEN;
+ break;
+ }
+ elfsym->internal_elf_sym.st_other
+ = (visibility | (elfsym->internal_elf_sym.st_other
+ & ~ELF_ST_VISIBILITY (-1)));
}
return LDPS_OK;
@@ -416,8 +437,8 @@ is_visible_from_outside (struct ld_plugin_symbol *lsym, asection *section,
opportunities during LTRANS at worst; it will not give false
negatives, which can lead to the disastrous conclusion that the
related symbol is IRONLY. (See GCC PR46319 for an example.) */
- return lsym->visibility == LDPV_DEFAULT
- || lsym->visibility == LDPV_PROTECTED;
+ return (lsym->visibility == LDPV_DEFAULT
+ || lsym->visibility == LDPV_PROTECTED);
}
return FALSE;
}