summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2014-05-07 07:54:11 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2014-05-07 07:54:11 +0000
commit3819f028190dfaa51a7a819b42be0bb508437504 (patch)
tree72cd6a98eb6c376d34290470b2a574f45f48017a /llvm/lib/Target/X86
parentcf86ce136c04e5c63be9ced1e8ded13f9ce60706 (diff)
downloadbcm5719-llvm-3819f028190dfaa51a7a819b42be0bb508437504.tar.gz
bcm5719-llvm-3819f028190dfaa51a7a819b42be0bb508437504.zip
[asan] Add a flag to control asm instrumentation.
With this change, asm instrumentation is disabled by default. llvm-svn: 208167
Diffstat (limited to 'llvm/lib/Target/X86')
-rw-r--r--llvm/lib/Target/X86/AsmParser/X86AsmInstrumentation.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmInstrumentation.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmInstrumentation.cpp
index c8b541f3af6..95e4ccccb9d 100644
--- a/llvm/lib/Target/X86/AsmParser/X86AsmInstrumentation.cpp
+++ b/llvm/lib/Target/X86/AsmParser/X86AsmInstrumentation.cpp
@@ -21,10 +21,16 @@
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/MC/MCTargetOptions.h"
+#include "llvm/Support/CommandLine.h"
namespace llvm {
namespace {
+static cl::opt<bool> ClAsanInstrumentAssembly(
+ "asan-instrument-assembly",
+ cl::desc("instrument assembly with AddressSanitizer checks"), cl::Hidden,
+ cl::init(false));
+
bool IsStackReg(unsigned Reg) {
return Reg == X86::RSP || Reg == X86::ESP || Reg == X86::SP;
}
@@ -212,7 +218,8 @@ CreateX86AsmInstrumentation(const MCTargetOptions &MCOptions,
const MCContext &Ctx, const MCSubtargetInfo &STI) {
Triple T(STI.getTargetTriple());
const bool hasCompilerRTSupport = T.isOSLinux();
- if (hasCompilerRTSupport && MCOptions.SanitizeAddress) {
+ if (ClAsanInstrumentAssembly && hasCompilerRTSupport &&
+ MCOptions.SanitizeAddress) {
if ((STI.getFeatureBits() & X86::Mode32Bit) != 0)
return new X86AddressSanitizer32(STI);
if ((STI.getFeatureBits() & X86::Mode64Bit) != 0)
OpenPOWER on IntegriCloud