summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2016-04-08 16:11:42 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2016-04-08 16:11:42 +0000
commita15fb15b0581ec6a187cceb677755800ba2fb58c (patch)
tree1ecc8dd48e7d4116386b2bf6677e8cdecd8e07a9
parent2d5126cdf57ac00388ee131dd7804c216ea4626e (diff)
downloadbcm5719-llvm-a15fb15b0581ec6a187cceb677755800ba2fb58c.tar.gz
bcm5719-llvm-a15fb15b0581ec6a187cceb677755800ba2fb58c.zip
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
-rw-r--r--lld/ELF/Symbols.cpp8
-rw-r--r--lld/test/ELF/Inputs/protected-shared.s4
-rw-r--r--lld/test/ELF/protected-shared.s11
3 files changed, 20 insertions, 3 deletions
diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp
index e699640f448..9def17c6dbb 100644
--- a/lld/ELF/Symbols.cpp
+++ b/lld/ELF/Symbols.cpp
@@ -218,9 +218,11 @@ int SymbolBody::compare(SymbolBody *Other) {
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;
diff --git a/lld/test/ELF/Inputs/protected-shared.s b/lld/test/ELF/Inputs/protected-shared.s
index a4c16df7ab4..342c37950a8 100644
--- a/lld/test/ELF/Inputs/protected-shared.s
+++ b/lld/test/ELF/Inputs/protected-shared.s
@@ -1,3 +1,7 @@
.global foo
.protected foo
foo:
+
+ .global bar
+ .protected bar
+bar:
diff --git a/lld/test/ELF/protected-shared.s b/lld/test/ELF/protected-shared.s
index 64c187edae3..ee931831b30 100644
--- a/lld/test/ELF/protected-shared.s
+++ b/lld/test/ELF/protected-shared.s
@@ -9,6 +9,17 @@
_start:
.quad foo
+ .global bar
+bar:
+
+// CHECK: Name: bar
+// CHECK-NEXT: Value:
+// CHECK-NEXT: Size: 0
+// CHECK-NEXT: Binding: Global
+// CHECK-NEXT: Type: None
+// CHECK-NEXT: Other: 0
+// CHECK-NEXT: Section: .text
+
// CHECK: Name: foo
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
OpenPOWER on IntegriCloud