summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenPGO.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CodeGen/CodeGenPGO.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenPGO.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenPGO.cpp b/clang/lib/CodeGen/CodeGenPGO.cpp
index 9d4aaff8888..22534b828ee 100644
--- a/clang/lib/CodeGen/CodeGenPGO.cpp
+++ b/clang/lib/CodeGen/CodeGenPGO.cpp
@@ -140,6 +140,15 @@ llvm::GlobalVariable *CodeGenPGO::buildDataVar() {
Data->setSection(getDataSection(CGM));
Data->setAlignment(8);
+ // Hide all these symbols so that we correctly get a copy for each
+ // executable. The profile format expects names and counters to be
+ // contiguous, so references into shared objects would be invalid.
+ if (!llvm::GlobalValue::isLocalLinkage(VarLinkage)) {
+ Name->setVisibility(llvm::GlobalValue::HiddenVisibility);
+ Data->setVisibility(llvm::GlobalValue::HiddenVisibility);
+ RegionCounters->setVisibility(llvm::GlobalValue::HiddenVisibility);
+ }
+
// Make sure the data doesn't get deleted.
CGM.addUsedGlobal(Data);
return Data;
OpenPOWER on IntegriCloud