[llvm] r230566 - InstrProf: Make the __llvm_profile_runtime_user symbol hidden

Justin Bogner mail at justinbogner.com
Wed Feb 25 14:52:22 PST 2015


Author: bogner
Date: Wed Feb 25 16:52:20 2015
New Revision: 230566

URL: http://llvm.org/viewvc/llvm-project?rev=230566&view=rev
Log:
InstrProf: Make the __llvm_profile_runtime_user symbol hidden

This symbol exists only to pull in the required pieces of the runtime,
so nothing ever needs to refer to it. Making it hidden avoids the
potential for issues with duplicate symbols when linking profiled
libraries together.

Modified:
    llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp
    llvm/trunk/test/Instrumentation/InstrProfiling/linkage.ll

Modified: llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp?rev=230566&r1=230565&r2=230566&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp Wed Feb 25 16:52:20 2015
@@ -288,6 +288,7 @@ void InstrProfiling::emitRuntimeHook() {
   User->addFnAttr(Attribute::NoInline);
   if (Options.NoRedZone)
     User->addFnAttr(Attribute::NoRedZone);
+  User->setVisibility(GlobalValue::HiddenVisibility);
 
   IRBuilder<> IRB(BasicBlock::Create(M->getContext(), "", User));
   auto *Load = IRB.CreateLoad(Var);

Modified: llvm/trunk/test/Instrumentation/InstrProfiling/linkage.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/InstrProfiling/linkage.ll?rev=230566&r1=230565&r2=230566&view=diff
==============================================================================
--- llvm/trunk/test/Instrumentation/InstrProfiling/linkage.ll (original)
+++ llvm/trunk/test/Instrumentation/InstrProfiling/linkage.ll Wed Feb 25 16:52:20 2015
@@ -40,7 +40,7 @@ declare void @llvm.instrprof.increment(i
 
 ; CHECK: @__llvm_profile_runtime = external global i32
 
-; CHECK: define linkonce_odr i32 @__llvm_profile_runtime_user() {{.*}} {
+; CHECK: define linkonce_odr hidden i32 @__llvm_profile_runtime_user() {{.*}} {
 ; CHECK:   %[[REG:.*]] = load i32* @__llvm_profile_runtime
 ; CHECK:   ret i32 %[[REG]]
 ; CHECK: }





More information about the llvm-commits mailing list