diff mbox series

[poky,master,v2] gcc-sanitizers.inc: Workaround for aarch64

Message ID 20250122124407.258555-1-throos@amazon.de
State New
Headers show
Series [poky,master,v2] gcc-sanitizers.inc: Workaround for aarch64 | expand

Commit Message

Roos, Thomas Jan. 22, 2025, 12:44 p.m. UTC
From: Thomas Roos <throos@amazon.de>

When using the -fsanitize=address  CXX_FLAG for a program compiled for
aarch64 / arm64

This is happing:
MemorySanitizer: CHECK failed: sanitizer_allocator_primary64.h:133 "((kSpaceBeg))
 == ((address_range.Init(TotalSpaceSize, PrimaryAllocatorName, kSpaceBeg)))"
 (0xe00000000000, 0xfffffffffffffff4) (tid=51745)

With -DSANITIZER_CAN_USE_ALLOCATOR64=0 this is not happening and
potenial bugs are detected.

ARM32 does not require this patch.

More info about the issue in this thread:
https://github.com/llvm/llvm-project/issues/65144

Signed-off-by: Thomas Roos <throos@amazon.de>
---
 meta/recipes-devtools/gcc/gcc-sanitizers.inc | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/meta/recipes-devtools/gcc/gcc-sanitizers.inc b/meta/recipes-devtools/gcc/gcc-sanitizers.inc
index 8c98e9cf8a..3b044e3571 100644
--- a/meta/recipes-devtools/gcc/gcc-sanitizers.inc
+++ b/meta/recipes-devtools/gcc/gcc-sanitizers.inc
@@ -11,6 +11,10 @@  EXTRA_OECONF_PATHS = "\
     --with-build-sysroot=${STAGING_DIR_TARGET} \
 "
 
+# Workaround for this issue: https://github.com/llvm/llvm-project/issues/65144 on aarch64
+# compiler-rt/sanitizers/aarch64: CHECK failed: sanitizer_allocator_primary64.h:133
+CXXFLAGS:append:aarch64 = " -DSANITIZER_CAN_USE_ALLOCATOR64=0"
+
 do_configure () {
     rm -rf ${B}/${TARGET_SYS}/libsanitizer/
     mkdir -p ${B}/${TARGET_SYS}/libsanitizer/