[compiler-rt][TySan] Add Hexagon target support (#191603)
Add shadow memory mapping for Hexagon (32-bit architecture) and enable the TySan build for the Hexagon target. Hexagon uses a 4-byte shadow entry (PtrShift=2) with the shadow region at 0x80000000-0xBFFFFFFF (1GB). A 28-bit mask (kAppMemMsk) covers 256MB of app address space; addresses differing only in bits 28-31 alias in the shadow. kAppAddr is set to 0xC0000000 to size the mmap to exactly the 1GB shadow region.
This commit is contained in:
@@ -102,7 +102,7 @@ else()
|
|||||||
set(ALL_TSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64} ${ARM64} ${PPC64} ${S390X}
|
set(ALL_TSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64} ${ARM64} ${PPC64} ${S390X}
|
||||||
${LOONGARCH64} ${RISCV64})
|
${LOONGARCH64} ${RISCV64})
|
||||||
endif()
|
endif()
|
||||||
set(ALL_TYSAN_SUPPORTED_ARCH ${X86_64} ${ARM64} ${S390X})
|
set(ALL_TYSAN_SUPPORTED_ARCH ${X86_64} ${ARM64} ${S390X} ${HEXAGON})
|
||||||
set(ALL_UBSAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${RISCV64}
|
set(ALL_UBSAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${RISCV64}
|
||||||
${MIPS32} ${MIPS64} ${PPC64} ${S390X} ${SPARC} ${SPARCV9} ${HEXAGON}
|
${MIPS32} ${MIPS64} ${PPC64} ${S390X} ${SPARC} ${SPARCV9} ${HEXAGON}
|
||||||
${LOONGARCH64} ${AMDGPU} ${NVPTX})
|
${LOONGARCH64} ${AMDGPU} ${NVPTX})
|
||||||
|
|||||||
@@ -52,6 +52,20 @@ struct Mapping {
|
|||||||
static const uptr kAppMemMsk = ~0xC00000000000ULL;
|
static const uptr kAppMemMsk = ~0xC00000000000ULL;
|
||||||
static const uptr kPtrShift = 3;
|
static const uptr kPtrShift = 3;
|
||||||
};
|
};
|
||||||
|
#elif defined(__hexagon__)
|
||||||
|
// Hexagon is a 32-bit architecture. Each shadow entry is a 4-byte pointer
|
||||||
|
// (PtrShift=2). The shadow occupies 4x the masked app memory range.
|
||||||
|
// With a 28-bit mask (256MB of app addresses), the shadow is 1GB at
|
||||||
|
// 0x80000000-0xBFFFFFFF. App addresses that differ only in bits 28-31
|
||||||
|
// will alias in the shadow; in practice this means code/heap (low addresses)
|
||||||
|
// and stack (~0x40000000) may share shadow entries, which can cause
|
||||||
|
// false positives in rare cases.
|
||||||
|
struct Mapping {
|
||||||
|
static const uptr kShadowAddr = 0x80000000u;
|
||||||
|
static const uptr kAppAddr = 0xC0000000u;
|
||||||
|
static const uptr kAppMemMsk = ~0xF0000000u;
|
||||||
|
static const uptr kPtrShift = 2;
|
||||||
|
};
|
||||||
#else
|
#else
|
||||||
#error "TySan not supported for this platform!"
|
#error "TySan not supported for this platform!"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user