summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2018-02-08 01:16:05 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2018-02-08 01:16:05 +0000
commit362fccf131c775a3a6379d1acb2a92adaca4aca6 (patch)
tree2cd445a3c3b0714855167372745e457c28c8167f
parentc908e3f77ad425d984dea1f86a7924180da8e9fc (diff)
downloadbcm5719-llvm-362fccf131c775a3a6379d1acb2a92adaca4aca6.tar.gz
bcm5719-llvm-362fccf131c775a3a6379d1acb2a92adaca4aca6.zip
Fix PR36268.
The issue is that clang was first creating a extern_weak hidden GV and then changing the linkage to external. Once we know it is not extern_weak we know it must be dso_local. This patch refactors the code that sets the implicit dso_local to a helper private function that is used every time we change the linkage or visibility. I will commit a patch to clang in a minute. llvm-svn: 324551
-rw-r--r--llvm/include/llvm/IR/GlobalValue.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/llvm/include/llvm/IR/GlobalValue.h b/llvm/include/llvm/IR/GlobalValue.h
index 116b54e0d0f..9478a4633f7 100644
--- a/llvm/include/llvm/IR/GlobalValue.h
+++ b/llvm/include/llvm/IR/GlobalValue.h
@@ -112,6 +112,12 @@ protected:
private:
friend class Constant;
+ void maybeSetDsoLocal() {
+ if (hasLocalLinkage() ||
+ (!hasDefaultVisibility() && !hasExternalWeakLinkage()))
+ setDSOLocal(true);
+ }
+
// Give subclasses access to what otherwise would be wasted padding.
// (17 + 4 + 2 + 2 + 2 + 3 + 1 + 1) == 32.
unsigned SubClassData : GlobalValueSubClassDataBits;
@@ -233,8 +239,7 @@ public:
assert((!hasLocalLinkage() || V == DefaultVisibility) &&
"local linkage requires default visibility");
Visibility = V;
- if (!hasExternalWeakLinkage() && V != DefaultVisibility)
- setDSOLocal(true);
+ maybeSetDsoLocal();
}
/// If the value is "Thread Local", its value isn't shared by the threads.
@@ -437,11 +442,10 @@ public:
}
void setLinkage(LinkageTypes LT) {
- if (isLocalLinkage(LT)) {
+ if (isLocalLinkage(LT))
Visibility = DefaultVisibility;
- setDSOLocal(true);
- }
Linkage = LT;
+ maybeSetDsoLocal();
}
LinkageTypes getLinkage() const { return LinkageTypes(Linkage); }
OpenPOWER on IntegriCloud