[llvm] r338650 - [ASAN] Use the correct shadow offset for ASAN on FreeBSD/mips64.
John Baldwin via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 1 15:51:13 PDT 2018
Author: jhb
Date: Wed Aug 1 15:51:13 2018
New Revision: 338650
URL: http://llvm.org/viewvc/llvm-project?rev=338650&view=rev
Log:
[ASAN] Use the correct shadow offset for ASAN on FreeBSD/mips64.
Reviewed By: atanasyan
Differential Revision: https://reviews.llvm.org/D49939
Modified:
llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
llvm/trunk/test/Instrumentation/AddressSanitizer/freebsd.ll
Modified: llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp?rev=338650&r1=338649&r2=338650&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp Wed Aug 1 15:51:13 2018
@@ -538,7 +538,7 @@ static ShadowMapping getShadowMapping(Tr
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;
Modified: llvm/trunk/test/Instrumentation/AddressSanitizer/freebsd.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/AddressSanitizer/freebsd.ll?rev=338650&r1=338649&r2=338650&view=diff
==============================================================================
--- llvm/trunk/test/Instrumentation/AddressSanitizer/freebsd.ll (original)
+++ llvm/trunk/test/Instrumentation/AddressSanitizer/freebsd.ll Wed Aug 1 15:51:13 2018
@@ -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 @@ entry:
; 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
More information about the llvm-commits
mailing list