[llvm] r287117 - [sancov] Name the global containing the main source file name

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 16 08:50:43 PST 2016


Author: rnk
Date: Wed Nov 16 10:50:43 2016
New Revision: 287117

URL: http://llvm.org/viewvc/llvm-project?rev=287117&view=rev
Log:
[sancov] Name the global containing the main source file name

If the global name doesn't start with __sancov_gen, ASan will insert
unecessary red zones around it.

Modified:
    llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
    llvm/trunk/test/Instrumentation/SanitizerCoverage/coverage.ll

Modified: llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp?rev=287117&r1=287116&r2=287117&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp Wed Nov 16 10:50:43 2016
@@ -357,9 +357,9 @@ bool SanitizerCoverageModule::runOnModul
   // Create variable for module (compilation unit) name
   Constant *ModNameStrConst =
       ConstantDataArray::getString(M.getContext(), M.getName(), true);
-  GlobalVariable *ModuleName =
-      new GlobalVariable(M, ModNameStrConst->getType(), true,
-                         GlobalValue::PrivateLinkage, ModNameStrConst);
+  GlobalVariable *ModuleName = new GlobalVariable(
+      M, ModNameStrConst->getType(), true, GlobalValue::PrivateLinkage,
+      ModNameStrConst, "__sancov_gen_modname");
   if (Options.TracePCGuard) {
     if (HasSancovGuardsSection) {
       Function *CtorFunc;

Modified: llvm/trunk/test/Instrumentation/SanitizerCoverage/coverage.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/coverage.ll?rev=287117&r1=287116&r2=287117&view=diff
==============================================================================
--- llvm/trunk/test/Instrumentation/SanitizerCoverage/coverage.ll (original)
+++ llvm/trunk/test/Instrumentation/SanitizerCoverage/coverage.ll Wed Nov 16 10:50:43 2016
@@ -49,7 +49,7 @@ entry:
 
 ; CHECK1-LABEL: define internal void @sancov.module_ctor
 ; CHECK1-NOT: ret
-; CHECK1: call void @__sanitizer_cov_module_init({{.*}}, i64 2,
+; CHECK1: call void @__sanitizer_cov_module_init({{.*}}, i64 2, {{.*}}@__sancov_gen_modname
 ; CHECK1: ret
 
 ; CHECK_WITH_CHECK-LABEL: define void @foo




More information about the llvm-commits mailing list