diff options
author | Reid Kleckner <rnk@google.com> | 2016-11-16 16:50:43 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2016-11-16 16:50:43 +0000 |
commit | 3a83e76811d7d8b8a4bfd45943dbd89cb08ee522 (patch) | |
tree | 4a18c408353ea376fc20057eb3684e0c5381c82e | |
parent | e870398e48baf31321de4bd16f83a51becb1c7b9 (diff) | |
download | llvm-3a83e76811d7d8b8a4bfd45943dbd89cb08ee522.zip llvm-3a83e76811d7d8b8a4bfd45943dbd89cb08ee522.tar.gz llvm-3a83e76811d7d8b8a4bfd45943dbd89cb08ee522.tar.bz2 |
[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.
llvm-svn: 287117
-rw-r--r-- | llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp | 6 | ||||
-rw-r--r-- | llvm/test/Instrumentation/SanitizerCoverage/coverage.ll | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp b/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp index 031effb..730e28a 100644 --- a/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp +++ b/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp @@ -357,9 +357,9 @@ bool SanitizerCoverageModule::runOnModule(Module &M) { // 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; diff --git a/llvm/test/Instrumentation/SanitizerCoverage/coverage.ll b/llvm/test/Instrumentation/SanitizerCoverage/coverage.ll index bc32374..a2a92a0 100644 --- a/llvm/test/Instrumentation/SanitizerCoverage/coverage.ll +++ b/llvm/test/Instrumentation/SanitizerCoverage/coverage.ll @@ -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 |