[compiler-rt] asan_static x86-64: Support 64-bit ASAN_SHADOW_OFFSET_CONST redux (PR #76185)
Dan McGregor via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 21 13:30:44 PST 2023
https://github.com/dankm created https://github.com/llvm/llvm-project/pull/76185
Similar to b9935bb02a50, but also apply a similar change to ACCESS_CHECK_ADD.
If ASAN_SHADOW_OFFSET_CONST cannot be encoded as a displacement, switch to `movabsq` and the register offset variant of cmp.
>From 3938d0ba521e78adce57cba171dd82510fef6d28 Mon Sep 17 00:00:00 2001
From: Dan McGregor <dan.mcgregor at usask.ca>
Date: Thu, 21 Dec 2023 15:24:20 -0600
Subject: [PATCH] asan_static x86-64: Support 64-bit ASAN_SHADOW_OFFSET_CONST
redux (#75748)
Similar to b9935bb02a50, but also apply a similar change to
ACCESS_CHECK_ADD.
If ASAN_SHADOW_OFFSET_CONST cannot be encoded as a displacement, switch
to `movabsq` and the register offset variant of cmp.
---
compiler-rt/lib/asan/asan_rtl_x86_64.S | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/compiler-rt/lib/asan/asan_rtl_x86_64.S b/compiler-rt/lib/asan/asan_rtl_x86_64.S
index e44587ac4331c7..3f8800d31ac566 100644
--- a/compiler-rt/lib/asan/asan_rtl_x86_64.S
+++ b/compiler-rt/lib/asan/asan_rtl_x86_64.S
@@ -89,7 +89,12 @@ ENDF
#define ASAN_MEMORY_ACCESS_CHECK_ADD(reg, op, s, c) \
mov %##reg,%r10 ;\
shr $0x3,%r10 ;\
+ .if ASAN_SHADOW_OFFSET_CONST < 0x80000000 ;\
##c $0x0,ASAN_SHADOW_OFFSET_CONST(%r10) ;\
+ .else ;\
+ movabsq $ASAN_SHADOW_OFFSET_CONST,%r11 ;\
+ ##c $0x0,(%r10,%r11) ;\
+ .endif ;\
jne FLABEL(reg, op, s, add) ;\
retq ;\
More information about the llvm-commits
mailing list