llvm.org GIT mirror llvm / 227c4c6
[asan] Add a flag to control asm instrumentation. With this change, asm instrumentation is disabled by default. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208167 91177308-0d34-0410-b5e6-96231b3b80d8 Evgeniy Stepanov 6 years ago
5 changed file(s) with 12 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
2020 #include "llvm/MC/MCStreamer.h"
2121 #include "llvm/MC/MCSubtargetInfo.h"
2222 #include "llvm/MC/MCTargetOptions.h"
23 #include "llvm/Support/CommandLine.h"
2324
2425 namespace llvm {
2526 namespace {
27
28 static cl::opt ClAsanInstrumentAssembly(
29 "asan-instrument-assembly",
30 cl::desc("instrument assembly with AddressSanitizer checks"), cl::Hidden,
31 cl::init(false));
2632
2733 bool IsStackReg(unsigned Reg) {
2834 return Reg == X86::RSP || Reg == X86::ESP || Reg == X86::SP;
211217 const MCContext &Ctx, const MCSubtargetInfo &STI) {
212218 Triple T(STI.getTargetTriple());
213219 const bool hasCompilerRTSupport = T.isOSLinux();
214 if (hasCompilerRTSupport && MCOptions.SanitizeAddress) {
220 if (ClAsanInstrumentAssembly && hasCompilerRTSupport &&
221 MCOptions.SanitizeAddress) {
215222 if ((STI.getFeatureBits() & X86::Mode32Bit) != 0)
216223 return new X86AddressSanitizer32(STI);
217224 if ((STI.getFeatureBits() & X86::Mode64Bit) != 0)
None ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=corei7 -mattr=+sse2 -asm-instrumentation=address | FileCheck %s
0 ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=corei7 -mattr=+sse2 -asm-instrumentation=address -asan-instrument-assembly | FileCheck %s
11
22 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
33 target triple = "x86_64-unknown-linux-gnu"
None ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=corei7 -mattr=+sse2 -asm-instrumentation=address | FileCheck %s
0 ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=corei7 -mattr=+sse2 -asm-instrumentation=address -asan-instrument-assembly | FileCheck %s
11
22 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
33 target triple = "x86_64-unknown-linux-gnu"
None # RUN: llvm-mc %s -triple=x86_64-unknown-linux-gnu -mcpu=corei7 -mattr=+sse2 -asm-instrumentation=address | FileCheck %s
0 # RUN: llvm-mc %s -triple=x86_64-unknown-linux-gnu -mcpu=corei7 -mattr=+sse2 -asm-instrumentation=address -asan-instrument-assembly | FileCheck %s
11
22 .text
33 .globl mov1b
None # RUN: llvm-mc %s -x86-asm-syntax=intel -triple=x86_64-unknown-linux-gnu -asm-instrumentation=address | FileCheck %s
0 # RUN: llvm-mc %s -x86-asm-syntax=intel -triple=x86_64-unknown-linux-gnu -asm-instrumentation=address -asan-instrument-assembly | FileCheck %s
11
22 .text
33 .globl swap