Don't lower the visibility because of shared symbols.
If a shared library has a protected symbol 'foo', that doesn't imply
that the symbol 'foo' in the output should be protected or not.
llvm-svn: 265794
diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp
index e699640..9def17c 100644
--- a/lld/ELF/Symbols.cpp
+++ b/lld/ELF/Symbols.cpp
@@ -218,9 +218,11 @@
if (L > R)
return -Other->compare(this);
- uint8_t V = getMinVisibility(getVisibility(), Other->getVisibility());
- setVisibility(V);
- Other->setVisibility(V);
+ if (!isShared() && !Other->isShared()) {
+ uint8_t V = getMinVisibility(getVisibility(), Other->getVisibility());
+ setVisibility(V);
+ Other->setVisibility(V);
+ }
if (IsUsedInRegularObj || Other->IsUsedInRegularObj)
IsUsedInRegularObj = Other->IsUsedInRegularObj = true;