summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2014-04-30 14:04:31 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2014-04-30 14:04:31 +0000
commit55f8c07504f765159a1389945488fe15ae7d9422 (patch)
tree485c45f9ca88354768a3e42b2f6d284165cb2dc4 /lib
parentee053f4f51dc4eda3701d42a68e448299e8a8b44 (diff)
downloadllvm-55f8c07504f765159a1389945488fe15ae7d9422.tar.gz
llvm-55f8c07504f765159a1389945488fe15ae7d9422.tar.bz2
llvm-55f8c07504f765159a1389945488fe15ae7d9422.tar.xz
[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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207651 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/X86/AsmParser/X86AsmInstrumentation.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/Target/X86/AsmParser/X86AsmInstrumentation.cpp b/lib/Target/X86/AsmParser/X86AsmInstrumentation.cpp
index 030778af7e..c8b541f3af 100644
--- a/lib/Target/X86/AsmParser/X86AsmInstrumentation.cpp
+++ b/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)