[llvm] 19e7741 - [TargetMachine] Set dso_local for memprof

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 5 21:11:17 PST 2020


Author: Vitaly Buka
Date: 2020-12-05T21:11:04-08:00
New Revision: 19e7741fef775b2f4f497c44b6aeab350f43f9a7

URL: https://github.com/llvm/llvm-project/commit/19e7741fef775b2f4f497c44b6aeab350f43f9a7
DIFF: https://github.com/llvm/llvm-project/commit/19e7741fef775b2f4f497c44b6aeab350f43f9a7.diff

LOG: [TargetMachine] Set dso_local for memprof

Similar to 5582a7987662a92eda5d883b88fc4586e755acf5

Added: 
    

Modified: 
    llvm/lib/Target/TargetMachine.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/TargetMachine.cpp b/llvm/lib/Target/TargetMachine.cpp
index f214a47ba702..d9c894537b72 100644
--- a/llvm/lib/Target/TargetMachine.cpp
+++ b/llvm/lib/Target/TargetMachine.cpp
@@ -163,10 +163,11 @@ bool TargetMachine::shouldAssumeDSOLocal(const Module &M,
     // If the symbol is defined, it cannot be preempted.
     if (!GV->isDeclarationForLinker())
       return true;
-    // FIXME asan does not call setDSOLocal appropriately. Fix asan and delete
-    // the hack.
+    // FIXME Sanitizers do not call setDSOLocal appropriately. Fix sanitizers
+    // and delete the hack.
     if (RM == Reloc::Static && !GV->isThreadLocal() &&
-        M.getFunction("asan.module_ctor"))
+        (M.getFunction("asan.module_ctor") ||
+         M.getFunction("memprof.module_ctor")))
       return true;
   } else if (TT.isOSBinFormatELF()) {
     // If dso_local allows AsmPrinter::getSymbolPreferLocal to use a local


        


More information about the llvm-commits mailing list