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 | eaad5be64467dbb0e056b4f8b7a27ec76e6e4262 (patch) | |
| tree | 96df21f7ab50e7063a8ef757b39693e2ec2d5ede /lib/CodeGen/CodeGenPGO.cpp | |
| parent | efed1a7b694ae1f2f619eb50146850d770cf6618 (diff) | |
| download | clang-eaad5be64467dbb0e056b4f8b7a27ec76e6e4262.tar.gz clang-eaad5be64467dbb0e056b4f8b7a27ec76e6e4262.tar.bz2 clang-eaad5be64467dbb0e056b4f8b7a27ec76e6e4262.tar.xz | |
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>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208939 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenPGO.cpp')
| -rw-r--r-- | lib/CodeGen/CodeGenPGO.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/CodeGen/CodeGenPGO.cpp b/lib/CodeGen/CodeGenPGO.cpp index 9d4aaff888..22534b828e 100644 --- a/lib/CodeGen/CodeGenPGO.cpp +++ b/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; |
