Skip to contentSkip to conversation

gcc-sanitizers.inc: Workaround for aarch64

PATCH Superseded [email protected] 2 participants 2 messages Jan 22, 2025

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gcc-sanitizers.inc: Workaround for aarch64

From: Thomas Roos <[email protected]>

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

---
 meta/recipes-devtools/gcc/gcc-sanitizers.inc | 2 ++
 1 file changed, 2 insertions(+)
meta/recipes-devtools/gcc/gcc-sanitizers.inc +2 -0
index 8c98e9cf8a..ae05ae6dfd 100644
@@ -11,6 +11,8 @@ EXTRA_OECONF_PATHS = "\
     --with-build-sysroot=${STAGING_DIR_TARGET} \
 "
 
+CXXFLAGS:append:aarch64 = " -DSANITIZER_CAN_USE_ALLOCATOR64=0"
+
 do_configure () {
     rm -rf ${B}/${TARGET_SYS}/libsanitizer/
     mkdir -p ${B}/${TARGET_SYS}/libsanitizer/
Signature · 1 line
2.34.1
#1 lore raw
Quoted 33 lines · Thomas Roos via lists.openembedded.org

From: Thomas Roos <[email protected]>

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

---
 meta/recipes-devtools/gcc/gcc-sanitizers.inc | 2 ++

 1 file changed, 2 insertions(+)
meta/recipes-devtools/gcc/gcc-sanitizers.inc +0 -0
index 8c98e9cf8a..ae05ae6dfd 100644
@@ -11,6 +11,8 @@ EXTRA_OECONF_PATHS = "\
      --with-build-sysroot=${STAGING_DIR_TARGET} \

 "

meta/recipes-devtools/gcc/gcc-sanitizers.inc +2 -0
+CXXFLAGS:append:aarch64 = " -DSANITIZER_CAN_USE_ALLOCATOR64=0"
+
Quoted 4 lines

 do_configure () {
     rm -rf ${B}/${TARGET_SYS}/libsanitizer/
     mkdir -p ${B}/${TARGET_SYS}/libsanitizer/

Can you put that link and a short note in a comment above that append please? It is handy to have a reference and some idea of when we can remove it.

Cheers,

Richard