[compiler-rt] asan_static x86-64: Support 64-bit ASAN_SHADOW_OFFSET_CONST redux (PR #76185)

via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 21 13:31:12 PST 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Dan McGregor (dankm)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/76185.diff


1 Files Affected:

- (modified) compiler-rt/lib/asan/asan_rtl_x86_64.S (+5) 


``````````diff
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  ;\
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/76185


More information about the llvm-commits mailing list