Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ASan][test] Enable ASan tests on SPARC #107405

Merged
merged 2 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler-rt/lib/asan/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ if(COMPILER_RT_CAN_EXECUTE_TESTS AND NOT ANDROID)
if(APPLE)
darwin_filter_host_archs(ASAN_SUPPORTED_ARCH ASAN_TEST_ARCH)
endif()
list(REMOVE_ITEM ASAN_TEST_ARCH sparc sparcv9)
list(REMOVE_ITEM ASAN_TEST_ARCH sparcv9)
if(OS_NAME MATCHES "SunOS")
list(REMOVE_ITEM ASAN_TEST_ARCH x86_64)
endif()
Expand Down
9 changes: 8 additions & 1 deletion compiler-rt/lib/asan/tests/asan_oob_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
//===----------------------------------------------------------------------===//
#include "asan_test_utils.h"

#ifdef __sparc__
// Tests using unaligned accesses cannot work on strict-alignment targets.
#define SKIP_ON_STRICT_ALIGNMENT(x) DISABLED_##x
#else
#define SKIP_ON_STRICT_ALIGNMENT(x) x
#endif

NOINLINE void asan_write_sized_aligned(uint8_t *p, size_t size) {
EXPECT_EQ(0U, ((uintptr_t)p % size));
if (size == 1) asan_write((uint8_t*)p);
Expand Down Expand Up @@ -79,7 +86,7 @@ TEST(AddressSanitizer, OOB_char) {
OOBTest<U1>();
}

TEST(AddressSanitizer, OOB_int) {
TEST(AddressSanitizer, SKIP_ON_STRICT_ALIGNMENT(OOB_int)) {
OOBTest<U4>();
}

Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/lib/asan/tests/asan_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ NOINLINE void SigLongJmpFunc1(sigjmp_buf buf) {

#if !defined(__ANDROID__) && !defined(__arm__) && !defined(__aarch64__) && \
!defined(__mips__) && !defined(__mips64) && !defined(__s390__) && \
!defined(__riscv) && !defined(__loongarch__)
!defined(__riscv) && !defined(__loongarch__) && !defined(__sparc__)
NOINLINE void BuiltinLongJmpFunc1(jmp_buf buf) {
// create three red zones for these two stack objects.
int a;
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/test/asan/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ set(ASAN_TEST_ARCH ${ASAN_SUPPORTED_ARCH})
if(APPLE)
darwin_filter_host_archs(ASAN_SUPPORTED_ARCH ASAN_TEST_ARCH)
endif()
list(REMOVE_ITEM ASAN_TEST_ARCH sparc sparcv9)
list(REMOVE_ITEM ASAN_TEST_ARCH sparcv9)
if(OS_NAME MATCHES "SunOS")
list(REMOVE_ITEM ASAN_TEST_ARCH x86_64)
endif()
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/test/asan/TestCases/zero_page_pc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ int main() {
// the compiler is free to choose the order. As a result, the address is
// either 0x4, 0xc or 0x14. The pc is still in main() because it has not
// actually made the call when the faulting access occurs.
// CHECK: {{AddressSanitizer: (SEGV|access-violation).*(address|pc) 0x0*[4c]}}
// CHECK: {{AddressSanitizer: (SEGV|access-violation).*(address|pc) 0x0*[45c]}}
return 0;
}
2 changes: 1 addition & 1 deletion compiler-rt/test/sanitizer_common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ foreach(tool ${SUPPORTED_TOOLS})
darwin_filter_host_archs(${tool_toupper}_SUPPORTED_ARCH TEST_ARCH)
endif()
if(${tool} STREQUAL "asan")
list(REMOVE_ITEM TEST_ARCH sparc sparcv9)
list(REMOVE_ITEM TEST_ARCH sparcv9)
endif()
if(OS_NAME MATCHES "SunOS" AND ${tool} STREQUAL "asan")
list(REMOVE_ITEM TEST_ARCH x86_64)
Expand Down
4 changes: 2 additions & 2 deletions compiler-rt/test/ubsan/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ foreach(arch ${UBSAN_TEST_ARCH})
if(COMPILER_RT_HAS_ASAN AND ";${ASAN_SUPPORTED_ARCH};" MATCHES ";${arch};")
# TODO(wwchrome): Re-enable ubsan for asan win 64-bit when ready.
# Disable ubsan with AddressSanitizer tests for Windows 64-bit,
# 64-bit Solaris/x86, and SPARC.
# 64-bit Solaris/x86 and 64-bit SPARC.
if((NOT (OS_NAME MATCHES "Windows" AND CMAKE_SIZEOF_VOID_P EQUAL 8)) AND
(NOT (OS_NAME MATCHES "SunOS" AND ${arch} MATCHES x86_64)) AND
(NOT ${arch} MATCHES sparc))
(NOT ${arch} MATCHES sparcv9))
add_ubsan_testsuites("AddressSanitizer" asan ${arch})
endif()
endif()
Expand Down
Loading