diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-05-16 01:24:00 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-05-16 01:24:00 +0000 |
commit | 912122080412e7d91ba5c7e3d3259803f8e776b3 (patch) | |
tree | 6026d22907fdf09478ff06288e7aea3242df30c3 /clang/lib/CodeGen | |
parent | a119f323446b0655ad59e3a24488ea5ff375aa71 (diff) | |
download | bcm5719-llvm-912122080412e7d91ba5c7e3d3259803f8e776b3.tar.gz bcm5719-llvm-912122080412e7d91ba5c7e3d3259803f8e776b3.zip |
InstrProf: Set profile data to visibility hidden
Shared objects are fairly broken for InstrProf right now -- a follow-up
commit in compiler-rt will fix the rest of this.
The main problem here is that at link time, profile data symbols in the
shared object might get used instead of symbols from the main
executable, creating invalid profile data sections.
<rdar://problem/16918688>
llvm-svn: 208939
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CodeGenPGO.cpp | 9 |
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; |