diff options
| author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2014-04-30 14:04:31 +0000 |
|---|---|---|
| committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2014-04-30 14:04:31 +0000 |
| commit | 29865f7803df8faa56ba143bb1b3ce6e5d25b403 (patch) | |
| tree | aaef55e20a6a1cc21896c4438a0093a72191b305 /llvm/lib | |
| parent | 3ffee2340e08ddd785d951340f6c01ea875955f3 (diff) | |
| download | bcm5719-llvm-29865f7803df8faa56ba143bb1b3ce6e5d25b403.tar.gz bcm5719-llvm-29865f7803df8faa56ba143bb1b3ce6e5d25b403.zip | |
[asan] Disable asm instrumentation on unsupported platforms.
Only emit calls to compiler-rt asm routines on platforms where they are
present (currently limited to linux i386/x86_64).
Patch by Yuri Gorshenin.
llvm-svn: 207651
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Target/X86/AsmParser/X86AsmInstrumentation.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmInstrumentation.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmInstrumentation.cpp index 030778af7e1..c8b541f3af6 100644 --- a/llvm/lib/Target/X86/AsmParser/X86AsmInstrumentation.cpp +++ b/llvm/lib/Target/X86/AsmParser/X86AsmInstrumentation.cpp @@ -11,6 +11,7 @@ #include "X86AsmInstrumentation.h" #include "X86Operand.h" #include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/Triple.h" #include "llvm/IR/Function.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCInst.h" @@ -207,9 +208,11 @@ void X86AsmInstrumentation::InstrumentInstruction( MCContext &Ctx, const MCInstrInfo &MII, MCStreamer &Out) {} X86AsmInstrumentation * -CreateX86AsmInstrumentation(const MCTargetOptions &MCOptions, const MCContext &Ctx, - const MCSubtargetInfo &STI) { - if (MCOptions.SanitizeAddress) { +CreateX86AsmInstrumentation(const MCTargetOptions &MCOptions, + const MCContext &Ctx, const MCSubtargetInfo &STI) { + Triple T(STI.getTargetTriple()); + const bool hasCompilerRTSupport = T.isOSLinux(); + if (hasCompilerRTSupport && MCOptions.SanitizeAddress) { if ((STI.getFeatureBits() & X86::Mode32Bit) != 0) return new X86AddressSanitizer32(STI); if ((STI.getFeatureBits() & X86::Mode64Bit) != 0) |

