[PATCH] D49939: [ASAN] Use the correct shadow offset for ASAN on FreeBSD/mips64.
John Baldwin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 27 14:54:02 PDT 2018
bsdjhb created this revision.
bsdjhb added reviewers: atanasyan, sdardis.
Herald added subscribers: arichardson, emaste.
Repository:
rL LLVM
https://reviews.llvm.org/D49939
Files:
lib/Transforms/Instrumentation/AddressSanitizer.cpp
test/Instrumentation/AddressSanitizer/freebsd.ll
Index: test/Instrumentation/AddressSanitizer/freebsd.ll
===================================================================
--- test/Instrumentation/AddressSanitizer/freebsd.ll
+++ test/Instrumentation/AddressSanitizer/freebsd.ll
@@ -8,6 +8,11 @@
; RUN: -data-layout="e-m:e-i64:64-f80:128-n8:16:32:64-S128" | \
; RUN: FileCheck --check-prefix=CHECK-64 %s
+; RUN: opt < %s -asan -asan-module -S \
+; RUN: -mtriple=mips64-unknown-freebsd \
+; RUN: -data-layout="E-m:e-i64:64-n32:64-S128" | \
+; RUN: FileCheck --check-prefix=CHECK-MIPS64 %s
+
define i32 @read_4_bytes(i32* %a) sanitize_address {
entry:
%tmp1 = load i32, i32* %a, align 4
@@ -27,3 +32,10 @@
; CHECK-64: lshr {{.*}} 3
; CHECK-64-NEXT: {{70368744177664}}
; CHECK-64: ret
+
+; CHECK-MIPS64: @read_4_bytes
+; CHECK-MIPS64-NOT: ret
+; Check for ASAN's Offset for 64-bit (2^37 or 0x2000000000)
+; CHECK-MIPS64: lshr {{.*}} 3
+; CHECK-MIPS64-NEXT: {{137438953472}}
+; CHECK-MIPS64: ret
Index: lib/Transforms/Instrumentation/AddressSanitizer.cpp
===================================================================
--- lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -538,7 +538,7 @@
Mapping.Offset = kPPC64_ShadowOffset64;
else if (IsSystemZ)
Mapping.Offset = kSystemZ_ShadowOffset64;
- else if (IsFreeBSD)
+ else if (IsFreeBSD && !IsMIPS64)
Mapping.Offset = kFreeBSD_ShadowOffset64;
else if (IsNetBSD)
Mapping.Offset = kNetBSD_ShadowOffset64;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49939.157774.patch
Type: text/x-patch
Size: 1539 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180727/433ac964/attachment.bin>
More information about the llvm-commits
mailing list