diff --git a/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake b/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake index 2683259e93e37..0816a05a7fbbd 100644 --- a/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake +++ b/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake @@ -28,11 +28,11 @@ if(WIN32) set(ARM32 ${ARM32} armv7) endif() -set(ALL_SANITIZER_COMMON_SUPPORTED_ARCH ${X86} ${X86_64} ${PPC64} ${RISCV64} +set(ALL_SANITIZER_COMMON_SUPPORTED_ARCH ${X86} ${X86_64} ${PPC32} ${PPC64} ${RISCV64} ${ARM32} ${ARM64} ${MIPS32} ${MIPS64} ${S390X} ${SPARC} ${SPARCV9} ${HEXAGON} ${LOONGARCH64}) set(ALL_ASAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${RISCV64} - ${MIPS32} ${MIPS64} ${PPC64} ${S390X} ${SPARC} ${SPARCV9} ${HEXAGON} + ${MIPS32} ${MIPS64} ${PPC32} ${PPC64} ${S390X} ${SPARC} ${SPARCV9} ${HEXAGON} ${LOONGARCH64}) set(ALL_ASAN_ABI_SUPPORTED_ARCH ${X86_64} ${ARM64} ${ARM64_32}) set(ALL_DFSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64} ${ARM64} ${LOONGARCH64}) diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake index e3310b1ff0e2c..e3f918b3dda5b 100644 --- a/compiler-rt/cmake/config-ix.cmake +++ b/compiler-rt/cmake/config-ix.cmake @@ -141,6 +141,7 @@ check_cxx_compiler_flag("-Werror -Wgnu" COMPILER_RT_HAS_WGNU_FLAG check_cxx_compiler_flag("-Werror -Wgnu-anonymous-struct" COMPILER_RT_HAS_WGNU_ANONYMOUS_STRUCT_FLAG) check_cxx_compiler_flag("-Werror -Wvariadic-macros" COMPILER_RT_HAS_WVARIADIC_MACROS_FLAG) check_cxx_compiler_flag("-Werror -Wunused-parameter" COMPILER_RT_HAS_WUNUSED_PARAMETER_FLAG) +check_cxx_compiler_flag("-Werror -Watomic-alignment" COMPILER_RT_HAS_WATOMIC_ALIGNMENT_FLAG) check_cxx_compiler_flag("-Werror -Wcovered-switch-default" COMPILER_RT_HAS_WCOVERED_SWITCH_DEFAULT_FLAG) check_cxx_compiler_flag("-Werror -Wsuggest-override" COMPILER_RT_HAS_WSUGGEST_OVERRIDE_FLAG) check_cxx_compiler_flag("-Werror -Wthread-safety" COMPILER_RT_HAS_WTHREAD_SAFETY_FLAG) @@ -760,7 +761,7 @@ set(COMPILER_RT_SANITIZERS_TO_BUILD all CACHE STRING list_replace(COMPILER_RT_SANITIZERS_TO_BUILD all "${ALL_SANITIZERS}") if (SANITIZER_COMMON_SUPPORTED_ARCH AND NOT LLVM_USE_SANITIZER AND - (OS_NAME MATCHES "Android|Darwin|Linux|FreeBSD|NetBSD|Fuchsia|SunOS|Haiku" OR + (OS_NAME MATCHES "Android|Darwin|Linux|FreeBSD|NetBSD|Fuchsia|SunOS|Haiku|AIX" OR (OS_NAME MATCHES "Windows" AND NOT CYGWIN AND (NOT MINGW OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")))) set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE) diff --git a/compiler-rt/lib/asan/tests/CMakeLists.txt b/compiler-rt/lib/asan/tests/CMakeLists.txt index 9cd9c97bed813..a871f61a471ed 100644 --- a/compiler-rt/lib/asan/tests/CMakeLists.txt +++ b/compiler-rt/lib/asan/tests/CMakeLists.txt @@ -80,6 +80,11 @@ if(NOT MSVC) list(APPEND ASAN_UNITTEST_COMMON_LINK_FLAGS --driver-mode=g++) endif() +# unittest will test asan sources which may require atomic library. + if (${CMAKE_SYSTEM_NAME} MATCHES "AIX") + list(APPEND ASAN_UNITTEST_COMMON_LINK_FLAGS -latomic) + endif() + # x86_64 FreeBSD 9.2 additionally requires libc++ to build the tests. if(CMAKE_SYSTEM MATCHES "FreeBSD-9.2-RELEASE") list(APPEND ASAN_UNITTEST_COMMON_LINK_FLAGS "-lc++") @@ -240,7 +245,8 @@ function(add_asan_tests arch test_runtime) LINK_FLAGS ${ASAN_UNITTEST_INSTRUMENTED_LINK_FLAGS} ${TARGET_LINK_FLAGS}) endfunction() -if(COMPILER_RT_CAN_EXECUTE_TESTS AND NOT ANDROID) +# AIX can not run unittest because of shared library interception issue. +if(COMPILER_RT_CAN_EXECUTE_TESTS AND NOT ANDROID AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "AIX") set(ASAN_TEST_ARCH ${ASAN_SUPPORTED_ARCH}) if(APPLE) darwin_filter_host_archs(ASAN_SUPPORTED_ARCH ASAN_TEST_ARCH) diff --git a/compiler-rt/lib/sanitizer_common/tests/CMakeLists.txt b/compiler-rt/lib/sanitizer_common/tests/CMakeLists.txt index 55c7d665e639f..3d0e20b693e70 100644 --- a/compiler-rt/lib/sanitizer_common/tests/CMakeLists.txt +++ b/compiler-rt/lib/sanitizer_common/tests/CMakeLists.txt @@ -100,6 +100,10 @@ if(NOT MSVC) list(APPEND SANITIZER_TEST_LINK_FLAGS_COMMON --driver-mode=g++) endif() +if(${CMAKE_SYSTEM_NAME} MATCHES "AIX") + list(APPEND SANITIZER_TEST_LINK_FLAGS_COMMON -latomic) +endif() + if(ANDROID) list(APPEND SANITIZER_TEST_LINK_FLAGS_COMMON -pie) endif() diff --git a/compiler-rt/lib/sanitizer_common/tests/sanitizer_test_utils.h b/compiler-rt/lib/sanitizer_common/tests/sanitizer_test_utils.h index 5fd94a0281391..10cebd4d80486 100644 --- a/compiler-rt/lib/sanitizer_common/tests/sanitizer_test_utils.h +++ b/compiler-rt/lib/sanitizer_common/tests/sanitizer_test_utils.h @@ -101,8 +101,8 @@ static inline uint32_t my_rand() { #endif #if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__ANDROID__) && \ - !defined(__NetBSD__) && !defined(_WIN32) -# define SANITIZER_TEST_HAS_MEMALIGN 1 + !defined(__NetBSD__) && !defined(_WIN32) && !defined(_AIX) +# define SANITIZER_TEST_HAS_MEMALIGN 1 #else # define SANITIZER_TEST_HAS_MEMALIGN 0 #endif diff --git a/compiler-rt/test/asan/CMakeLists.txt b/compiler-rt/test/asan/CMakeLists.txt index 414a6cc9496ed..9a8283f68d07e 100644 --- a/compiler-rt/test/asan/CMakeLists.txt +++ b/compiler-rt/test/asan/CMakeLists.txt @@ -16,7 +16,7 @@ endif() macro(get_bits_for_arch arch bits) if (${arch} MATCHES "x86_64|powerpc64|powerpc64le|aarch64|arm64|mips64|mips64el|s390x|sparcv9|riscv64|loongarch64") set(${bits} 64) - elseif (${arch} MATCHES "i386|arm|mips|mipsel|sparc") + elseif (${arch} MATCHES "i386|arm|mips|mipsel|sparc|powerpc") set(${bits} 32) else() message(FATAL_ERROR "Unknown target architecture: ${arch}") diff --git a/compiler-rt/test/asan/TestCases/Posix/asan-symbolize-bad-path.cpp b/compiler-rt/test/asan/TestCases/Posix/asan-symbolize-bad-path.cpp index c53a932a2e9ed..51a7887e16ff6 100644 --- a/compiler-rt/test/asan/TestCases/Posix/asan-symbolize-bad-path.cpp +++ b/compiler-rt/test/asan/TestCases/Posix/asan-symbolize-bad-path.cpp @@ -11,6 +11,10 @@ // CHECK-BAD-ADDR: #0 0xabcdabcd // CHECK-BAD-ADDR-EMPTY: +// AIX does not have a system symbolizer which will return result like expected. +// llvm-symbolizer will not generate expected result either, an error will be emitted indicating "No such file or directory". +// UNSUPPORTED: target={{.*aix.*}} + int main() { return 0; } diff --git a/compiler-rt/test/asan/TestCases/Posix/asan-symbolize-sanity-test.cpp b/compiler-rt/test/asan/TestCases/Posix/asan-symbolize-sanity-test.cpp index 5d3e7a767e45a..91aacede0909e 100644 --- a/compiler-rt/test/asan/TestCases/Posix/asan-symbolize-sanity-test.cpp +++ b/compiler-rt/test/asan/TestCases/Posix/asan-symbolize-sanity-test.cpp @@ -11,6 +11,10 @@ // UNSUPPORTED: ios +// Asan on AIX doesn't print the full path for user libraries or executables, so this test fails to +// symbolize. +// UNSUPPORTED: target={{.*}}-aix{{.*}} + #if !defined(SHARED_LIB) #include #include diff --git a/compiler-rt/test/asan/TestCases/Posix/asan_symbolize_script/plugin_no_op_symbolicate.cpp b/compiler-rt/test/asan/TestCases/Posix/asan_symbolize_script/plugin_no_op_symbolicate.cpp index 3f3ad9bfdf753..ea61ddd4c6029 100644 --- a/compiler-rt/test/asan/TestCases/Posix/asan_symbolize_script/plugin_no_op_symbolicate.cpp +++ b/compiler-rt/test/asan/TestCases/Posix/asan_symbolize_script/plugin_no_op_symbolicate.cpp @@ -1,6 +1,10 @@ // UNSUPPORTED: ios, android // Check plugin command line args get parsed and that plugin functions get called as expected. +// Asan on AIX doesn't print the full path for user libraries or executables, so this test fails to +// symbolize. +// UNSUPPORTED: target={{.*}}-aix{{.*}} + // RUN: %clangxx_asan -O0 -g %s -o %t.executable // RUN: not %env_asan_opts=symbolize=0 %run %t.executable > %t.log 2>&1 // RUN: %asan_symbolize --plugins %S/plugin_no_op.py --log-level info -l %t.log --unlikely-option-name-XXX=15 2>&1 | FileCheck %s diff --git a/compiler-rt/test/asan/TestCases/Posix/asan_symbolize_script/plugin_wrong_frame_number_bug.cpp b/compiler-rt/test/asan/TestCases/Posix/asan_symbolize_script/plugin_wrong_frame_number_bug.cpp index c3383d6082b44..f806aa0bf7800 100644 --- a/compiler-rt/test/asan/TestCases/Posix/asan_symbolize_script/plugin_wrong_frame_number_bug.cpp +++ b/compiler-rt/test/asan/TestCases/Posix/asan_symbolize_script/plugin_wrong_frame_number_bug.cpp @@ -3,6 +3,10 @@ // UNSUPPORTED: android // UNSUPPORTED: ios +// Asan on AIX doesn't print the full path for user libraries or executables, so this test fails to +// symbolize. +// UNSUPPORTED: target={{.*}}-aix{{.*}} + // RUN: %clangxx_asan -O0 -g %s -o %t // RUN: %env_asan_opts=symbolize=0 not %run %t DUMMY_ARG > %t.asan_report 2>&1 // RUN: %asan_symbolize --log-level debug --log-dest %t_debug_log_output.txt -l %t.asan_report --plugins %S/plugin_wrong_frame_number_bug.py > %t.asan_report_sym diff --git a/compiler-rt/test/asan/TestCases/Posix/asprintf.cpp b/compiler-rt/test/asan/TestCases/Posix/asprintf.cpp index 6946e5013d2cb..c83112423f3ed 100644 --- a/compiler-rt/test/asan/TestCases/Posix/asprintf.cpp +++ b/compiler-rt/test/asan/TestCases/Posix/asprintf.cpp @@ -1,6 +1,9 @@ // RUN: %clangxx_asan -O0 %s -o %t && %run %t 2>&1 | FileCheck %s // RUN: %clangxx_asan -O3 %s -o %t && %run %t 2>&1 | FileCheck %s +// AIX libc does not define asprintf. +// UNSUPPORTED: target={{.*aix.*}} + #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif diff --git a/compiler-rt/test/asan/TestCases/Posix/closed-fds.cpp b/compiler-rt/test/asan/TestCases/Posix/closed-fds.cpp index c18653bc29ef0..6d2fa77f8978f 100644 --- a/compiler-rt/test/asan/TestCases/Posix/closed-fds.cpp +++ b/compiler-rt/test/asan/TestCases/Posix/closed-fds.cpp @@ -30,6 +30,6 @@ int main(int argc, char **argv) { // CHECK-FILE: {{.*ERROR: AddressSanitizer: heap-use-after-free on address}} // CHECK-FILE: {{0x.* at pc 0x.* bp 0x.* sp 0x.*}} // CHECK-FILE: {{WRITE of size 1 at 0x.* thread T0}} - // CHECK-FILE: {{ #0 0x.* in main .*closed-fds.cpp:}}[[@LINE-4]] + // CHECK-FILE: {{ #0 0x.* in \.?main .*closed-fds.cpp:}}[[@LINE-4]] return 0; } diff --git a/compiler-rt/test/asan/TestCases/Posix/coverage-fork.cpp b/compiler-rt/test/asan/TestCases/Posix/coverage-fork.cpp index a8768479de2f6..9f2507defcf2b 100644 --- a/compiler-rt/test/asan/TestCases/Posix/coverage-fork.cpp +++ b/compiler-rt/test/asan/TestCases/Posix/coverage-fork.cpp @@ -6,6 +6,8 @@ // UNSUPPORTED: android // UNSUPPORTED: iossim // +// UNSUPPORTED: target={{.*aix.*}} + // Ideally a forked-subprocess should only report it's own coverage, // not parent's one. But trace-pc-guard currently does nothing special for fork, // and thus this test is relaxed. diff --git a/compiler-rt/test/asan/TestCases/Posix/coverage-module-unloaded.cpp b/compiler-rt/test/asan/TestCases/Posix/coverage-module-unloaded.cpp index d301bb5c7838d..8250752290172 100644 --- a/compiler-rt/test/asan/TestCases/Posix/coverage-module-unloaded.cpp +++ b/compiler-rt/test/asan/TestCases/Posix/coverage-module-unloaded.cpp @@ -11,6 +11,9 @@ // XFAIL: android // UNSUPPORTED: ios +// FIXME: support -fsanitize-coverage on AIX +// UNSUPPORTED: target={{.*aix.*}} + #include #include #include diff --git a/compiler-rt/test/asan/TestCases/Posix/coverage-reset.cpp b/compiler-rt/test/asan/TestCases/Posix/coverage-reset.cpp index e89181cc6c376..6781d8e59db18 100644 --- a/compiler-rt/test/asan/TestCases/Posix/coverage-reset.cpp +++ b/compiler-rt/test/asan/TestCases/Posix/coverage-reset.cpp @@ -5,6 +5,8 @@ // // UNSUPPORTED: ios +// UNSUPPORTED: target={{.*aix.*}} + #include #include diff --git a/compiler-rt/test/asan/TestCases/Posix/coverage.cpp b/compiler-rt/test/asan/TestCases/Posix/coverage.cpp index 12a88402eb5aa..25f1a0fa98495 100644 --- a/compiler-rt/test/asan/TestCases/Posix/coverage.cpp +++ b/compiler-rt/test/asan/TestCases/Posix/coverage.cpp @@ -20,6 +20,9 @@ // XFAIL: android // UNSUPPORTED: ios +// FIXME: support -fsanitize-coverage on AIX. +// UNSUPPORTED: target={{.*aix.*}} + #include #include #include diff --git a/compiler-rt/test/asan/TestCases/Posix/deep_call_stack.cpp b/compiler-rt/test/asan/TestCases/Posix/deep_call_stack.cpp index 1342eae927794..a40fd3ac790dd 100644 --- a/compiler-rt/test/asan/TestCases/Posix/deep_call_stack.cpp +++ b/compiler-rt/test/asan/TestCases/Posix/deep_call_stack.cpp @@ -1,7 +1,8 @@ // Check that UAR mode can handle very deep recursion. +// On AIX, we need a large stack size to contain all the 15000 frames and its callees. // REQUIRES: shell // RUN: %clangxx_asan -O2 %s -o %t -// RUN: ulimit -s 4096 +// RUN: ulimit -s 8192 // RUN: %env_asan_opts=detect_stack_use_after_return=1 %run %t 2>&1 | FileCheck %s // Also check that use_sigaltstack+verbosity doesn't crash. diff --git a/compiler-rt/test/asan/TestCases/Posix/fake_stack_gc.cpp b/compiler-rt/test/asan/TestCases/Posix/fake_stack_gc.cpp index 36fdf81120b59..d28b7d9abe94e 100644 --- a/compiler-rt/test/asan/TestCases/Posix/fake_stack_gc.cpp +++ b/compiler-rt/test/asan/TestCases/Posix/fake_stack_gc.cpp @@ -7,6 +7,9 @@ // (https://github.com/llvm/llvm-project/issues/64942). // UNSUPPORTED: iossim +// FIXME: investigate this failure on AIX. +// UNSUPPORTED: target={{.*aix.*}} + #include #include #include diff --git a/compiler-rt/test/asan/TestCases/Posix/fgets_fputs.cpp b/compiler-rt/test/asan/TestCases/Posix/fgets_fputs.cpp index 34c952f2e02ef..5c8677b00ed9a 100644 --- a/compiler-rt/test/asan/TestCases/Posix/fgets_fputs.cpp +++ b/compiler-rt/test/asan/TestCases/Posix/fgets_fputs.cpp @@ -47,8 +47,8 @@ int main(int argc, char *argv[]) { } // CHECK-FGETS: {{.*ERROR: AddressSanitizer: stack-buffer-overflow}} -// CHECK-FGETS: #{{.*}} in {{(wrap_|__interceptor_)?}}fgets +// CHECK-FGETS: #{{.*}} in {{(wrap_|__interceptor_)?}}{{\.?fgets}} // CHECK-FPUTS: {{.*ERROR: AddressSanitizer: stack-buffer-overflow}} -// CHECK-FPUTS: #{{.*}} in {{(wrap_|__interceptor_)?}}fputs +// CHECK-FPUTS: #{{.*}} in {{(wrap_|__interceptor_)?}}{{\.?fputs}} // CHECK-PUTS: {{.*ERROR: AddressSanitizer: heap-use-after-free}} -// CHECK-PUTS: #{{.*}} in {{(wrap_|__interceptor_)?}}puts +// CHECK-PUTS: #{{.*}} in {{(wrap_|__interceptor_)?}}{{\.?puts}} diff --git a/compiler-rt/test/asan/TestCases/Posix/fread_fwrite.cpp b/compiler-rt/test/asan/TestCases/Posix/fread_fwrite.cpp index c0629260418a3..064fd1fd4a6a8 100644 --- a/compiler-rt/test/asan/TestCases/Posix/fread_fwrite.cpp +++ b/compiler-rt/test/asan/TestCases/Posix/fread_fwrite.cpp @@ -29,6 +29,6 @@ int main(int argc, char *argv[]) { } // CHECK-FREAD: {{.*ERROR: AddressSanitizer: stack-buffer-overflow}} -// CHECK-FREAD: #{{.*}} in {{(wrap_|__interceptor_)?}}fread +// CHECK-FREAD: #{{.*}} in {{(wrap_|__interceptor_)?}}{{\.?fread}} // CHECK-FWRITE: {{.*ERROR: AddressSanitizer: stack-buffer-overflow}} -// CHECK-FWRITE: #{{.*}} in {{(wrap_|__interceptor_)?}}fwrite +// CHECK-FWRITE: #{{.*}} in {{(wrap_|__interceptor_)?}}{{\.?fwrite}} diff --git a/compiler-rt/test/asan/TestCases/Posix/interception-in-shared-lib-test.cpp b/compiler-rt/test/asan/TestCases/Posix/interception-in-shared-lib-test.cpp index b592edb9f3df0..5049f47c829c7 100644 --- a/compiler-rt/test/asan/TestCases/Posix/interception-in-shared-lib-test.cpp +++ b/compiler-rt/test/asan/TestCases/Posix/interception-in-shared-lib-test.cpp @@ -1,5 +1,8 @@ // Check that memset() call from a shared library gets intercepted. +// FIXME: Instructions don't start at 0x0 in shared libraries on AIX +// XFAIL: target={{.*-aix.*}} + // RUN: %clangxx_asan -O0 %s -DSHARED_LIB \ // RUN: -shared -o %dynamiclib -fPIC %ld_flags_rpath_so // RUN: %clangxx_asan -O0 %s -o %t %ld_flags_rpath_exe && \ @@ -21,7 +24,7 @@ int main(int argc, char *argv[]) { my_memset(buf, 11); // CHECK: {{.*ERROR: AddressSanitizer: stack-buffer-overflow}} // CHECK: {{WRITE of size 11 at 0x.* thread T0}} - // CHECK: {{0x.* in my_memset .*interception-in-shared-lib-test.cpp:}}[[@LINE-10]] + // CHECK: {{0x.* in \.?my_memset .*interception-in-shared-lib-test.cpp:}}[[@LINE-10]] return 0; } #endif diff --git a/compiler-rt/test/asan/TestCases/Posix/invalid-pointer-pairs-threads.cpp b/compiler-rt/test/asan/TestCases/Posix/invalid-pointer-pairs-threads.cpp index d32dae9c01e87..ee1cd71a90d78 100644 --- a/compiler-rt/test/asan/TestCases/Posix/invalid-pointer-pairs-threads.cpp +++ b/compiler-rt/test/asan/TestCases/Posix/invalid-pointer-pairs-threads.cpp @@ -1,6 +1,14 @@ +// On AIX, for 32 bit, the stack of main thread contains all other thread's stack. +// So we should be able to check invalid pointer based on the main thread stack, because +// all the stack address are in main thread's stack. +// However this is not true for 64 bit, for 64 bit, main thread stack does not overlap with +// other thread stack. This is same with other targets. +// See GetStackVariableShadowStart() for details. + // RUN: %clangxx_asan -O0 %s -pthread -o %t -mllvm -asan-detect-invalid-pointer-pair -// RUN: %env_asan_opts=detect_invalid_pointer_pairs=2 %run %t a 2>&1 | FileCheck %s -check-prefix=OK -allow-empty +// RUN: %if target={{.*aix.*}} && asan-32-bits %{ %env_asan_opts=detect_invalid_pointer_pairs=2 not %run %t a 2>&1 | FileCheck %s -check-prefix=AIX %} %else \ +// RUN: %{ %env_asan_opts=detect_invalid_pointer_pairs=2 %run %t a 2>&1 | FileCheck %s -check-prefix=OK -allow-empty %} // RUN: %env_asan_opts=detect_invalid_pointer_pairs=2 not %run %t b 2>&1 | FileCheck %s -check-prefix=B // pthread barriers are not available on OS X @@ -38,13 +46,15 @@ int main(int argc, char **argv) { if (t == 'a') { // OK-NOT: not handled yet + // AIX: ERROR: AddressSanitizer: invalid-pointer-pair + // AIX: #{{[0-9]+ .*}} in .main {{.*}}invalid-pointer-pairs-threads.cpp:[[@LINE+1]] unsigned r = pointers[0] - pointers[1]; } else { char local; char *parent_pointer = &local; // B: ERROR: AddressSanitizer: invalid-pointer-pair - // B: #{{[0-9]+ .*}} in main {{.*}}invalid-pointer-pairs-threads.cpp:[[@LINE+1]] + // B: #{{[0-9]+ .*}} in {{\.?main}} {{.*}}invalid-pointer-pairs-threads.cpp:[[@LINE+1]] unsigned r = parent_pointer - pointers[0]; } diff --git a/compiler-rt/test/asan/TestCases/Posix/ioctl.cpp b/compiler-rt/test/asan/TestCases/Posix/ioctl.cpp index 01e9843619b7f..25f530ba23b86 100644 --- a/compiler-rt/test/asan/TestCases/Posix/ioctl.cpp +++ b/compiler-rt/test/asan/TestCases/Posix/ioctl.cpp @@ -21,7 +21,7 @@ int main(int argc, char **argv) { int res = ioctl(fd, FIONBIO, &nonblock + 1); // CHECK: AddressSanitizer: stack-buffer-overflow // CHECK: READ of size 4 at - // CHECK: {{#.* in main .*ioctl.cpp:}}[[@LINE-3]] + // CHECK: {{#.* in \.?main .*ioctl.cpp:}}[[@LINE-3]] assert(res == 0); close(fd); return 0; diff --git a/compiler-rt/test/asan/TestCases/Posix/new_array_cookie_test.cpp b/compiler-rt/test/asan/TestCases/Posix/new_array_cookie_test.cpp index edbdb4016d86e..dc1b8b01635f9 100644 --- a/compiler-rt/test/asan/TestCases/Posix/new_array_cookie_test.cpp +++ b/compiler-rt/test/asan/TestCases/Posix/new_array_cookie_test.cpp @@ -19,9 +19,9 @@ struct C { int main(int argc, char **argv) { C *buffer = new C[argc]; buffer[-2].x = 10; -// CHECK: AddressSanitizer: heap-buffer-overflow -// CHECK: in main {{.*}}new_array_cookie_test.cpp:[[@LINE-2]] -// CHECK: is located 0 bytes inside of 12-byte region -// NO_COOKIE: ZZZZZZZZ + // CHECK: AddressSanitizer: heap-buffer-overflow + // CHECK: in {{\.?main}} {{.*}}new_array_cookie_test.cpp:[[@LINE-2]] + // CHECK: is located 0 bytes inside of 12-byte region + // NO_COOKIE: ZZZZZZZZ delete [] buffer; } diff --git a/compiler-rt/test/asan/TestCases/Posix/no_asan_gen_globals.c b/compiler-rt/test/asan/TestCases/Posix/no_asan_gen_globals.c index 994f827974be9..52c4b5c94f1f1 100644 --- a/compiler-rt/test/asan/TestCases/Posix/no_asan_gen_globals.c +++ b/compiler-rt/test/asan/TestCases/Posix/no_asan_gen_globals.c @@ -5,6 +5,8 @@ // RUN: %clang_asan %s -o %t.exe // RUN: nm %t.exe | FileCheck %s +// UNSUPPORTED: target={{.*aix.*}} + int x, y, z; int main() { return 0; } // CHECK-NOT: ___asan_gen_ diff --git a/compiler-rt/test/asan/TestCases/Posix/shared-lib-test.cpp b/compiler-rt/test/asan/TestCases/Posix/shared-lib-test.cpp index 6f0a9f74a1978..a7a3c250aa329 100644 --- a/compiler-rt/test/asan/TestCases/Posix/shared-lib-test.cpp +++ b/compiler-rt/test/asan/TestCases/Posix/shared-lib-test.cpp @@ -30,11 +30,11 @@ int main(int argc, char *argv[]) { if (!inc) return 1; printf("ok\n"); inc(1); - inc(-1); // BOOM + inc(11); // BOOM, 11 is more robust than -1 as -1 requires the GLOB and pad are stored adjacent. // CHECK: {{.*ERROR: AddressSanitizer: global-buffer-overflow}} // CHECK: {{READ of size 4 at 0x.* thread T0}} // CHECK: {{ #0 0x.*}} - // CHECK: {{ #1 0x.* in main .*shared-lib-test.cpp:}}[[@LINE-4]] + // CHECK: {{ #1 0x.* in \.?main .*shared-lib-test.cpp:}}[[@LINE-4]] return 0; } #else // SHARED_LIB diff --git a/compiler-rt/test/asan/TestCases/Posix/start-deactivated.cpp b/compiler-rt/test/asan/TestCases/Posix/start-deactivated.cpp index 4ddfd423167d3..9eb95a636624b 100644 --- a/compiler-rt/test/asan/TestCases/Posix/start-deactivated.cpp +++ b/compiler-rt/test/asan/TestCases/Posix/start-deactivated.cpp @@ -4,6 +4,10 @@ // Fails with debug checks: https://bugs.llvm.org/show_bug.cgi?id=46862 // XFAIL: !compiler-rt-optimized +// For this case, do_another_bad_thing(which calls malloc) is compiled to a shared library, +// and intercepting symbols in a shared library is still unsupported. +// UNSUPPORTED: target={{.*aix.*}} + // RUN: %clangxx_asan -O0 -DSHARED_LIB %s -std=c++11 -fPIC -shared -o %t-so.so // RUN: %clangxx -O0 %s -std=c++11 -c -o %t.o // RUN: %clangxx_asan -O0 %t.o %libdl -o %t diff --git a/compiler-rt/test/asan/TestCases/Posix/unpoison-alternate-stack.cpp b/compiler-rt/test/asan/TestCases/Posix/unpoison-alternate-stack.cpp index 8e7d5082d0b5d..eb66a3631a953 100644 --- a/compiler-rt/test/asan/TestCases/Posix/unpoison-alternate-stack.cpp +++ b/compiler-rt/test/asan/TestCases/Posix/unpoison-alternate-stack.cpp @@ -6,6 +6,9 @@ // RUN: %clangxx_asan -fexceptions -O0 %s -o %t -pthread // RUN: %env_asan_opts=detect_stack_use_after_return=0 %run %t +// This will hang on AIX +// UNSUPPORTED: target={{.*aix.*}} + #include #include #include diff --git a/compiler-rt/test/asan/TestCases/Posix/wait.cpp b/compiler-rt/test/asan/TestCases/Posix/wait.cpp index 7ca1c57a2edd9..7c6b33d2b4716 100644 --- a/compiler-rt/test/asan/TestCases/Posix/wait.cpp +++ b/compiler-rt/test/asan/TestCases/Posix/wait.cpp @@ -24,9 +24,9 @@ int main(int argc, char **argv) { // CHECK: stack-buffer-overflow // CHECK: {{WRITE of size .* at 0x.* thread T0}} // CHECK: {{in .*wait}} - // CHECK: {{in main .*wait.cpp:}} + // CHECK: {{in \.?main .*wait.cpp:}} // CHECK: is located in stack of thread T0 at offset - // CHECK: {{in main}} + // CHECK: {{in \.?main}} return res == -1 ? 1 : 0; } // child diff --git a/compiler-rt/test/asan/TestCases/Posix/wait3.cpp b/compiler-rt/test/asan/TestCases/Posix/wait3.cpp index 7fb4d65122592..8e3058b18dffd 100644 --- a/compiler-rt/test/asan/TestCases/Posix/wait3.cpp +++ b/compiler-rt/test/asan/TestCases/Posix/wait3.cpp @@ -26,9 +26,9 @@ int main(int argc, char **argv) { // CHECK: stack-buffer-overflow // CHECK: {{WRITE of size .* at 0x.* thread T0}} // CHECK: {{in .*wait}} - // CHECK: {{in main .*wait3.cpp:}} + // CHECK: {{in \.?main .*wait3.cpp:}} // CHECK: is located in stack of thread T0 at offset - // CHECK: {{in main}} + // CHECK: {{in \.?main}} return res == -1 ? 1 : 0; } // child diff --git a/compiler-rt/test/asan/TestCases/Posix/wait4.cpp b/compiler-rt/test/asan/TestCases/Posix/wait4.cpp index 1e574d99fe00c..925d537e934ec 100644 --- a/compiler-rt/test/asan/TestCases/Posix/wait4.cpp +++ b/compiler-rt/test/asan/TestCases/Posix/wait4.cpp @@ -34,9 +34,9 @@ int main(int argc, char **argv) { // CHECK: stack-buffer-overflow // CHECK: {{WRITE of size .* at 0x.* thread T0}} // CHECK: {{in .*wait}} - // CHECK: {{in main .*wait4.cpp:}} + // CHECK: {{in \.?main .*wait4.cpp:}} // CHECK: is located in stack of thread T0 at offset - // CHECK: {{in main}} + // CHECK: {{in \.?main}} return res == -1 ? 1 : 0; } // child diff --git a/compiler-rt/test/asan/TestCases/Posix/waitid.cpp b/compiler-rt/test/asan/TestCases/Posix/waitid.cpp index 96b91f94765c3..a4f1255f16258 100644 --- a/compiler-rt/test/asan/TestCases/Posix/waitid.cpp +++ b/compiler-rt/test/asan/TestCases/Posix/waitid.cpp @@ -20,9 +20,9 @@ int main(int argc, char **argv) { // CHECK: stack-buffer-overflow // CHECK: {{WRITE of size .* at 0x.* thread T0}} // CHECK: {{in .*waitid}} - // CHECK: {{in main .*waitid.cpp:}} + // CHECK: {{in \.?main .*waitid.cpp:}} // CHECK: is located in stack of thread T0 at offset - // CHECK: {{in main}} + // CHECK: {{in \.?main}} return res != -1; } // child diff --git a/compiler-rt/test/asan/TestCases/calloc-overflow.cpp b/compiler-rt/test/asan/TestCases/calloc-overflow.cpp index b930b65cd8c3b..c5c994d389dae 100644 --- a/compiler-rt/test/asan/TestCases/calloc-overflow.cpp +++ b/compiler-rt/test/asan/TestCases/calloc-overflow.cpp @@ -11,7 +11,7 @@ int main() { void *p = calloc(-1, 1000); // CHECK: {{ERROR: AddressSanitizer: calloc parameters overflow: count \* size \(.* \* 1000\) cannot be represented in type size_t}} // CHECK: {{#0 0x.* in .*calloc}} - // CHECK: {{#[1-3] 0x.* in main .*calloc-overflow.cpp:}}[[@LINE-3]] + // CHECK: {{#[1-3] 0x.* in \.?main .*calloc-overflow.cpp:}}[[@LINE-3]] // CHECK: SUMMARY: AddressSanitizer: calloc-overflow printf("calloc returned: %zu\n", (size_t)p); diff --git a/compiler-rt/test/asan/TestCases/coverage-disabled.cpp b/compiler-rt/test/asan/TestCases/coverage-disabled.cpp index 2a283b4652121..b8f4d7e3b3514 100644 --- a/compiler-rt/test/asan/TestCases/coverage-disabled.cpp +++ b/compiler-rt/test/asan/TestCases/coverage-disabled.cpp @@ -10,6 +10,9 @@ // // UNSUPPORTED: android +// FIXME: support -fsanitize-coverage on AIX +// UNSUPPORTED: target={{.*aix.*}} + int main(int argc, char **argv) { return 0; } diff --git a/compiler-rt/test/asan/TestCases/debug_double_free.cpp b/compiler-rt/test/asan/TestCases/debug_double_free.cpp index c1cc383b3c1e3..981fc2eafd7b9 100644 --- a/compiler-rt/test/asan/TestCases/debug_double_free.cpp +++ b/compiler-rt/test/asan/TestCases/debug_double_free.cpp @@ -13,8 +13,8 @@ # define PTR_FMT "0x%08x" # endif // Solaris libc omits the leading 0x. -#elif defined(__sun__) && defined(__svr4__) -# define PTR_FMT "0x%p" +#elif (defined(__sun__) && defined(__svr4__)) || defined(_AIX) +# define PTR_FMT "0x%p" #else # define PTR_FMT "%p" #endif diff --git a/compiler-rt/test/asan/TestCases/debug_locate.cpp b/compiler-rt/test/asan/TestCases/debug_locate.cpp index 2ccddd4739d4a..8066b493c9c0b 100644 --- a/compiler-rt/test/asan/TestCases/debug_locate.cpp +++ b/compiler-rt/test/asan/TestCases/debug_locate.cpp @@ -61,6 +61,9 @@ int main() { assert(region_address == heap_ptr); assert(10 == region_size); +// AIX 64-bit has a highly customized memory layout, it has no shadow gap and +// 3 mid memory regions. +#if !defined(__LP64__) || !defined(_AIX) size_t shadow_scale; size_t shadow_offset; __asan_get_shadow_mapping(&shadow_scale, &shadow_offset); @@ -73,6 +76,7 @@ int main() { uintptr_t shadow_gap = (shadow_ptr >> shadow_scale) + shadow_offset; type = __asan_locate_address((void *)shadow_gap, NULL, 0, NULL, NULL); assert(0 == strcmp(type, "shadow gap")); +#endif free(heap_ptr); diff --git a/compiler-rt/test/asan/TestCases/debug_ppc64_mapping.cpp b/compiler-rt/test/asan/TestCases/debug_ppc64_mapping.cpp index a67804023c0cd..813c85a4b8ae9 100644 --- a/compiler-rt/test/asan/TestCases/debug_ppc64_mapping.cpp +++ b/compiler-rt/test/asan/TestCases/debug_ppc64_mapping.cpp @@ -1,7 +1,7 @@ // RUN: %clang_asan -O0 %s -o %t // RUN: %env_asan_opts=verbosity=0 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-PPC64-V0 // RUN: %env_asan_opts=verbosity=2 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-PPC64 -// REQUIRES: powerpc64-target-arch +// REQUIRES: powerpc64-linux- #include diff --git a/compiler-rt/test/asan/TestCases/debug_report.cpp b/compiler-rt/test/asan/TestCases/debug_report.cpp index 0dbb9f2fb9988..733d95e4f8b3e 100644 --- a/compiler-rt/test/asan/TestCases/debug_report.cpp +++ b/compiler-rt/test/asan/TestCases/debug_report.cpp @@ -28,8 +28,8 @@ int main() { # define PTR_FMT "0x%08x" # endif // Solaris libc omits the leading 0x. -#elif defined(__sun__) && defined(__svr4__) -# define PTR_FMT "0x%p" +#elif (defined(__sun__) && defined(__svr4__)) || defined(_AIX) +# define PTR_FMT "0x%p" #else # define PTR_FMT "%p" #endif diff --git a/compiler-rt/test/asan/TestCases/double-free.cpp b/compiler-rt/test/asan/TestCases/double-free.cpp index 7b61df0715afa..5881a875a3df5 100644 --- a/compiler-rt/test/asan/TestCases/double-free.cpp +++ b/compiler-rt/test/asan/TestCases/double-free.cpp @@ -19,10 +19,10 @@ int main(int argc, char **argv) { free(x + argc - 1); // BOOM // CHECK: AddressSanitizer: attempting double-free{{.*}}in thread T0 // CHECK: #0 0x{{.*}} in {{.*}}free - // CHECK: #{{[1-3]}} 0x{{.*}} in main {{.*}}double-free.cpp:[[@LINE-3]] + // CHECK: #{{[1-3]}} 0x{{.*}} in {{\.?main}} {{.*}}double-free.cpp:[[@LINE-3]] // CHECK: freed by thread T0 here: // MALLOC-CTX: #0 0x{{.*}} in {{.*}}free - // MALLOC-CTX: #{{[1-3]}} 0x{{.*}} in main {{.*}}double-free.cpp:[[@LINE-7]] + // MALLOC-CTX: #{{[1-3]}} 0x{{.*}} in {{\.?main}} {{.*}}double-free.cpp:[[@LINE-7]] // CHECK: allocated by thread T0 here: // MALLOC-CTX: double-free.cpp:[[@LINE-12]] // CHECK-RECOVER: AddressSanitizer: attempting double-free{{.*}}in thread T0 diff --git a/compiler-rt/test/asan/TestCases/fakeframe-right-redzone.cpp b/compiler-rt/test/asan/TestCases/fakeframe-right-redzone.cpp index da1f5f2fb9789..9de9de593fab7 100644 --- a/compiler-rt/test/asan/TestCases/fakeframe-right-redzone.cpp +++ b/compiler-rt/test/asan/TestCases/fakeframe-right-redzone.cpp @@ -29,7 +29,7 @@ int main(int argc, char **argv) { char *x = OverwriteFakeFrameLastWord(); // CHECK: ERROR: AddressSanitizer: stack-buffer-overflow on address // CHECK: is located in stack of thread T0 at offset {{2040|2044}} in frame - // CHECK: in OverwriteFakeFrameLastWord{{.*}}fakeframe-right-redzone.cpp: + // CHECK: in {{\.?OverwriteFakeFrameLastWord}}{{.*}}fakeframe-right-redzone.cpp: // CHECK: [{{16|32}}, {{1040|1056}}) 'x' pretend_to_do_something(x); return 0; diff --git a/compiler-rt/test/asan/TestCases/frexp_interceptor.cpp b/compiler-rt/test/asan/TestCases/frexp_interceptor.cpp index d75ba992b650b..5e21b392667c4 100644 --- a/compiler-rt/test/asan/TestCases/frexp_interceptor.cpp +++ b/compiler-rt/test/asan/TestCases/frexp_interceptor.cpp @@ -2,6 +2,9 @@ // Test the frexp() interceptor. +// AIX does not intercept frexp +// UNSUPPORTED: target={{.*aix.*}} + #include #include #include diff --git a/compiler-rt/test/asan/TestCases/frexpf_interceptor.cpp b/compiler-rt/test/asan/TestCases/frexpf_interceptor.cpp index 91da09a6880cf..18fb71b9a89a8 100644 --- a/compiler-rt/test/asan/TestCases/frexpf_interceptor.cpp +++ b/compiler-rt/test/asan/TestCases/frexpf_interceptor.cpp @@ -2,6 +2,9 @@ // Test the frexpf() interceptor. +// AIX can not intercept frexpf because libc does not export this symbol. +// UNSUPPORTED: aix + #include #include #include diff --git a/compiler-rt/test/asan/TestCases/frexpl_interceptor.cpp b/compiler-rt/test/asan/TestCases/frexpl_interceptor.cpp index 721eecc6f82a3..2df5e431024cc 100644 --- a/compiler-rt/test/asan/TestCases/frexpl_interceptor.cpp +++ b/compiler-rt/test/asan/TestCases/frexpl_interceptor.cpp @@ -6,6 +6,10 @@ // interceptor seems to not work. // XFAIL: target={{.*-windows-gnu}} +// clang will expand frexpl to a function(with mangle name) that calls frexp. +// On AIX, frexp can not be intercepted. +// UNSUPPORTED: target={{.*aix.*}} + #include #include #include diff --git a/compiler-rt/test/asan/TestCases/global-location-nodebug.cpp b/compiler-rt/test/asan/TestCases/global-location-nodebug.cpp index 199816b8036ab..19a8403799d71 100644 --- a/compiler-rt/test/asan/TestCases/global-location-nodebug.cpp +++ b/compiler-rt/test/asan/TestCases/global-location-nodebug.cpp @@ -10,8 +10,10 @@ /// Solaris ld -S has different semantics, so enforce -fuse-ld= for /// configurations that default to GNU ld. -// XFAIL: target={{.*solaris.*}} +/// AIX ld -S has different semnatics. +// XFAIL: target={{.*solaris.*|.*aix.*}} // XFAIL: msvc + // CHECK: AddressSanitizer: global-buffer-overflow // CLASS_STATIC-NO-G: 0x{{.*}} is located 4 bytes after global variable '{{.*}}C::array{{.*}}' defined in '{{.*}}global-location.cpp' {{.*}} of size 40 // GLOB-NO-G: 0x{{.*}} is located 4 bytes after global variable '{{.*}}global{{.*}}' defined in '{{.*}}global-location.cpp' {{.*}} of size 40 diff --git a/compiler-rt/test/asan/TestCases/global-location.cpp b/compiler-rt/test/asan/TestCases/global-location.cpp index 7aa694159d03e..a72dd111196d2 100644 --- a/compiler-rt/test/asan/TestCases/global-location.cpp +++ b/compiler-rt/test/asan/TestCases/global-location.cpp @@ -10,6 +10,9 @@ // FIXME: Investigate failure on MinGW // XFAIL: target={{.*-windows-gnu}} +// FIXME: llvm-symbolizer on AIX can't resolve line number for the global +// XFAIL: target={{.*-aix.*}} + // atos doesn't show source line numbers for global variables. // UNSUPPORTED: darwin diff --git a/compiler-rt/test/asan/TestCases/global-overflow.cpp b/compiler-rt/test/asan/TestCases/global-overflow.cpp index ed276ca44aa26..7cb91d23659d1 100644 --- a/compiler-rt/test/asan/TestCases/global-overflow.cpp +++ b/compiler-rt/test/asan/TestCases/global-overflow.cpp @@ -16,7 +16,7 @@ int main(int argc, char **argv) { memset(ZZZ, 0, 10); int res = YYY[argc * 10]; // BOOOM // CHECK: {{READ of size 1 at 0x.* thread T0}} - // CHECK: {{ #0 0x.* in main .*global-overflow.cpp:}}[[@LINE-2]] + // CHECK: {{ #0 0x.* in \.?main .*global-overflow.cpp:}}[[@LINE-2]] // CHECK: {{0x.* is located 0 bytes after global variable}} // CHECK: {{.*YYY.* of size 10}} res += XXX[argc] + ZZZ[argc]; diff --git a/compiler-rt/test/asan/TestCases/global-underflow.cpp b/compiler-rt/test/asan/TestCases/global-underflow.cpp index fc9b14628aece..5f634b80da0e8 100644 --- a/compiler-rt/test/asan/TestCases/global-underflow.cpp +++ b/compiler-rt/test/asan/TestCases/global-underflow.cpp @@ -4,6 +4,11 @@ // RUN: %clangxx_asan -O2 %s %p/Helpers/underflow.cpp -o %t && not %run %t 2>&1 | FileCheck %s // RUN: %clangxx_asan -O3 %s %p/Helpers/underflow.cpp -o %t && not %run %t 2>&1 | FileCheck %s +// aix puts XXX and YYY at very different addresses. For example YYY is 0x20004340, XXX is 0x20000c20 +// This address allocation does not match the assumption in https://reviews.llvm.org/D38056. +// It was awared that this case may be not reliable on other OS. +// UNSUPPORTED: target={{.*aix.*}} + int XXX[2] = {2, 3}; extern int YYY[]; #include diff --git a/compiler-rt/test/asan/TestCases/heap-overflow.cpp b/compiler-rt/test/asan/TestCases/heap-overflow.cpp index f5bdcd5386373..7dee045a6e774 100644 --- a/compiler-rt/test/asan/TestCases/heap-overflow.cpp +++ b/compiler-rt/test/asan/TestCases/heap-overflow.cpp @@ -14,7 +14,7 @@ int main(int argc, char **argv) { memset(x, 0, 10); int res = x[argc * 10]; // BOOOM // CHECK: {{READ of size 1 at 0x.* thread T0}} - // CHECK: {{ #0 0x.* in main .*heap-overflow.cpp:}}[[@LINE-2]] + // CHECK: {{ #0 0x.* in \.?main .*heap-overflow.cpp:}}[[@LINE-2]] // CHECK: {{0x.* is located 0 bytes after 10-byte region}} // CHECK: {{allocated by thread T0 here:}} diff --git a/compiler-rt/test/asan/TestCases/heavy_uar_test.cpp b/compiler-rt/test/asan/TestCases/heavy_uar_test.cpp index 200d19cdbaf8a..3be9ee9af6001 100644 --- a/compiler-rt/test/asan/TestCases/heavy_uar_test.cpp +++ b/compiler-rt/test/asan/TestCases/heavy_uar_test.cpp @@ -72,7 +72,7 @@ int main(int argc, char **argv) { stale_stack[100]++; // CHECK: ERROR: AddressSanitizer: stack-use-after-return on address // CHECK: is located in stack of thread T0 at offset {{116|132}} in frame - // CHECK: in LeakStack{{.*}}heavy_uar_test.cpp: + // CHECK: in {{\.?LeakStack.*}}heavy_uar_test.cpp: // CHECK: [{{16|32}}, {{1040|1056}}) 'x' return 0; } diff --git a/compiler-rt/test/asan/TestCases/initialization-bug.cpp b/compiler-rt/test/asan/TestCases/initialization-bug.cpp index 1af6e256f0c24..d8173eaa4da1d 100644 --- a/compiler-rt/test/asan/TestCases/initialization-bug.cpp +++ b/compiler-rt/test/asan/TestCases/initialization-bug.cpp @@ -34,7 +34,7 @@ int ATTRIBUTE_NOINLINE initX() { // CHECK: {{READ of size .* at 0x.* thread T0}} // CHECK: {{0x.* is located 0 bytes inside of global variable .*(y|z).*}} // CHECK: registered at: - // CHECK: 0x{{.*}} in __asan_register_globals + // CHECK: 0x{{.*}} in {{\.?__asan_register_globals}} } // This initializer begins our initialization order problems. diff --git a/compiler-rt/test/asan/TestCases/intercept-rethrow-exception.cpp b/compiler-rt/test/asan/TestCases/intercept-rethrow-exception.cpp index 24b93c56e730c..aa8be6053b602 100644 --- a/compiler-rt/test/asan/TestCases/intercept-rethrow-exception.cpp +++ b/compiler-rt/test/asan/TestCases/intercept-rethrow-exception.cpp @@ -15,6 +15,10 @@ // https://reviews.llvm.org/D111703 made compiler incompatible with released NDK. // UNSUPPORTED: android && arm-target-arch +// make_exception_ptr on AIX will call __cxa_throw, and __cxa_throw will call malloc +// and memset, these function call will change shadow memory unexpectly. +// UNSUPPORTED: target={{.*aix.*}} + #include "defines.h" #include #include diff --git a/compiler-rt/test/asan/TestCases/invalid-pointer-pairs-compare-errors.cpp b/compiler-rt/test/asan/TestCases/invalid-pointer-pairs-compare-errors.cpp index 84c264b305692..e181794ed78bb 100644 --- a/compiler-rt/test/asan/TestCases/invalid-pointer-pairs-compare-errors.cpp +++ b/compiler-rt/test/asan/TestCases/invalid-pointer-pairs-compare-errors.cpp @@ -23,82 +23,82 @@ int main() { char *heap2 = (char *)malloc(42); // CHECK: ERROR: AddressSanitizer: invalid-pointer-pair - // CHECK: #{{[0-9]+ .*}} in main {{.*}}invalid-pointer-pairs-compare-errors.cpp:[[@LINE+1]] + // CHECK: #{{[0-9]+ .*}} in {{\.?main}} {{.*}}invalid-pointer-pairs-compare-errors.cpp:[[@LINE+1]] foo(heap1, heap2); free(heap1); free(heap2); heap1 = (char *)malloc(1024); // CHECK: ERROR: AddressSanitizer: invalid-pointer-pair - // CHECK: #{{[0-9]+ .*}} in main {{.*}}invalid-pointer-pairs-compare-errors.cpp:[[@LINE+1]] + // CHECK: #{{[0-9]+ .*}} in {{\.?main}} {{.*}}invalid-pointer-pairs-compare-errors.cpp:[[@LINE+1]] foo(heap1, heap1 + 1025); // CHECK: ERROR: AddressSanitizer: invalid-pointer-pair - // CHECK: #{{[0-9]+ .*}} in main {{.*}}invalid-pointer-pairs-compare-errors.cpp:[[@LINE+1]] + // CHECK: #{{[0-9]+ .*}} in {{\.?main}} {{.*}}invalid-pointer-pairs-compare-errors.cpp:[[@LINE+1]] foo(heap1 + 1024, heap1 + 1025); free(heap1); heap1 = (char *)malloc(4096); // CHECK: ERROR: AddressSanitizer: invalid-pointer-pair - // CHECK: #{{[0-9]+ .*}} in main {{.*}}invalid-pointer-pairs-compare-errors.cpp:[[@LINE+1]] + // CHECK: #{{[0-9]+ .*}} in {{\.?main}} {{.*}}invalid-pointer-pairs-compare-errors.cpp:[[@LINE+1]] foo(heap1, heap1 + 4097); // CHECK: ERROR: AddressSanitizer: invalid-pointer-pair - // CHECK: #{{[0-9]+ .*}} in main {{.*}}invalid-pointer-pairs-compare-errors.cpp:[[@LINE+1]] + // CHECK: #{{[0-9]+ .*}} in {{\.?main}} {{.*}}invalid-pointer-pairs-compare-errors.cpp:[[@LINE+1]] foo(heap1, 0); // Global variables. // CHECK: ERROR: AddressSanitizer: invalid-pointer-pair - // CHECK: #{{[0-9]+ .*}} in main {{.*}}invalid-pointer-pairs-compare-errors.cpp:[[@LINE+1]] + // CHECK: #{{[0-9]+ .*}} in {{\.?main}} {{.*}}invalid-pointer-pairs-compare-errors.cpp:[[@LINE+1]] foo(&global1[0], &global2[10]); char *p = &small_global[0]; foo(p, p); // OK foo(p, p + 7); // OK // CHECK: ERROR: AddressSanitizer: invalid-pointer-pair - // CHECK: #{{[0-9]+ .*}} in main {{.*}}invalid-pointer-pairs-compare-errors.cpp:[[@LINE+1]] + // CHECK: #{{[0-9]+ .*}} in {{\.?main}} {{.*}}invalid-pointer-pairs-compare-errors.cpp:[[@LINE+1]] foo(p, p + 8); // CHECK: ERROR: AddressSanitizer: invalid-pointer-pair - // CHECK: #{{[0-9]+ .*}} in main {{.*}}invalid-pointer-pairs-compare-errors.cpp:[[@LINE+1]] + // CHECK: #{{[0-9]+ .*}} in {{\.?main}} {{.*}}invalid-pointer-pairs-compare-errors.cpp:[[@LINE+1]] foo(p - 1, p); // CHECK: ERROR: AddressSanitizer: invalid-pointer-pair - // CHECK: #{{[0-9]+ .*}} in main {{.*}}invalid-pointer-pairs-compare-errors.cpp:[[@LINE+1]] + // CHECK: #{{[0-9]+ .*}} in {{\.?main}} {{.*}}invalid-pointer-pairs-compare-errors.cpp:[[@LINE+1]] foo(p, p - 1); // CHECK: ERROR: AddressSanitizer: invalid-pointer-pair - // CHECK: #{{[0-9]+ .*}} in main {{.*}}invalid-pointer-pairs-compare-errors.cpp:[[@LINE+1]] + // CHECK: #{{[0-9]+ .*}} in {{\.?main}} {{.*}}invalid-pointer-pairs-compare-errors.cpp:[[@LINE+1]] foo(p - 1, p + 8); p = &large_global[0]; // CHECK: ERROR: AddressSanitizer: invalid-pointer-pair - // CHECK: #{{[0-9]+ .*}} in main {{.*}}invalid-pointer-pairs-compare-errors.cpp:[[@LINE+1]] + // CHECK: #{{[0-9]+ .*}} in {{\.?main}} {{.*}}invalid-pointer-pairs-compare-errors.cpp:[[@LINE+1]] foo(p - 1, p); // CHECK: ERROR: AddressSanitizer: invalid-pointer-pair - // CHECK: #{{[0-9]+ .*}} in main {{.*}}invalid-pointer-pairs-compare-errors.cpp:[[@LINE+1]] + // CHECK: #{{[0-9]+ .*}} in {{\.?main}} {{.*}}invalid-pointer-pairs-compare-errors.cpp:[[@LINE+1]] foo(p, p - 1); // CHECK: ERROR: AddressSanitizer: invalid-pointer-pair - // CHECK: #{{[0-9]+ .*}} in main {{.*}}invalid-pointer-pairs-compare-errors.cpp:[[@LINE+1]] + // CHECK: #{{[0-9]+ .*}} in {{\.?main}} {{.*}}invalid-pointer-pairs-compare-errors.cpp:[[@LINE+1]] foo(p, &global1[0]); // CHECK: ERROR: AddressSanitizer: invalid-pointer-pair - // CHECK: #{{[0-9]+ .*}} in main {{.*}}invalid-pointer-pairs-compare-errors.cpp:[[@LINE+1]] + // CHECK: #{{[0-9]+ .*}} in {{\.?main}} {{.*}}invalid-pointer-pairs-compare-errors.cpp:[[@LINE+1]] foo(p, &small_global[0]); // CHECK: ERROR: AddressSanitizer: invalid-pointer-pair - // CHECK: #{{[0-9]+ .*}} in main {{.*}}invalid-pointer-pairs-compare-errors.cpp:[[@LINE+1]] + // CHECK: #{{[0-9]+ .*}} in {{\.?main}} {{.*}}invalid-pointer-pairs-compare-errors.cpp:[[@LINE+1]] foo(p, 0); // Stack variables. char stack1, stack2; // CHECK: ERROR: AddressSanitizer: invalid-pointer-pair - // CHECK: #{{[0-9]+ .*}} in main {{.*}}invalid-pointer-pairs-compare-errors.cpp:[[@LINE+1]] + // CHECK: #{{[0-9]+ .*}} in {{\.?main}} {{.*}}invalid-pointer-pairs-compare-errors.cpp:[[@LINE+1]] foo(&stack1, &stack2); // Mixtures. // CHECK: ERROR: AddressSanitizer: invalid-pointer-pair - // CHECK: #{{[0-9]+ .*}} in main {{.*}}invalid-pointer-pairs-compare-errors.cpp:[[@LINE+1]] + // CHECK: #{{[0-9]+ .*}} in {{\.?main}} {{.*}}invalid-pointer-pairs-compare-errors.cpp:[[@LINE+1]] foo(heap1, &stack1); // CHECK: ERROR: AddressSanitizer: invalid-pointer-pair foo(heap1, &global1[0]); // CHECK: ERROR: AddressSanitizer: invalid-pointer-pair foo(&stack1, &global1[0]); // CHECK: ERROR: AddressSanitizer: invalid-pointer-pair - // CHECK: #{{[0-9]+ .*}} in main {{.*}}invalid-pointer-pairs-compare-errors.cpp:[[@LINE+1]] + // CHECK: #{{[0-9]+ .*}} in {{\.?main}} {{.*}}invalid-pointer-pairs-compare-errors.cpp:[[@LINE+1]] foo(&stack1, 0); free(heap1); diff --git a/compiler-rt/test/asan/TestCases/invalid-pointer-pairs-subtract-errors.cpp b/compiler-rt/test/asan/TestCases/invalid-pointer-pairs-subtract-errors.cpp index 80742cddc0460..ea94003c90474 100644 --- a/compiler-rt/test/asan/TestCases/invalid-pointer-pairs-subtract-errors.cpp +++ b/compiler-rt/test/asan/TestCases/invalid-pointer-pairs-subtract-errors.cpp @@ -17,29 +17,29 @@ int main() { char *heap2 = (char *)malloc(42); // CHECK: ERROR: AddressSanitizer: invalid-pointer-pair - // CHECK: #{{[0-9]+ .*}} in main {{.*}}invalid-pointer-pairs-subtract-errors.cpp:[[@LINE+1]] + // CHECK: #{{[0-9]+ .*}} in {{main|.main}} {{.*}}invalid-pointer-pairs-subtract-errors.cpp:[[@LINE+1]] foo(heap1, heap2); // Global variables. // CHECK: ERROR: AddressSanitizer: invalid-pointer-pair - // CHECK: #{{[0-9]+ .*}} in main {{.*}}invalid-pointer-pairs-subtract-errors.cpp:[[@LINE+1]] + // CHECK: #{{[0-9]+ .*}} in {{main|.main}} {{.*}}invalid-pointer-pairs-subtract-errors.cpp:[[@LINE+1]] foo(&global1[0], &global2[10]); // Stack variables. char stack1, stack2; // CHECK: ERROR: AddressSanitizer: invalid-pointer-pair - // CHECK: #{{[0-9]+ .*}} in main {{.*}}invalid-pointer-pairs-subtract-errors.cpp:[[@LINE+1]] + // CHECK: #{{[0-9]+ .*}} in {{main|.main}} {{.*}}invalid-pointer-pairs-subtract-errors.cpp:[[@LINE+1]] foo(&stack1, &stack2); // Mixtures. // CHECK: ERROR: AddressSanitizer: invalid-pointer-pair - // CHECK: #{{[0-9]+ .*}} in main {{.*}}invalid-pointer-pairs-subtract-errors.cpp:[[@LINE+1]] + // CHECK: #{{[0-9]+ .*}} in {{main|.main}} {{.*}}invalid-pointer-pairs-subtract-errors.cpp:[[@LINE+1]] foo(heap1, &stack1); // CHECK: ERROR: AddressSanitizer: invalid-pointer-pair - // CHECK: #{{[0-9]+ .*}} in main {{.*}}invalid-pointer-pairs-subtract-errors.cpp:[[@LINE+1]] + // CHECK: #{{[0-9]+ .*}} in {{main|.main}} {{.*}}invalid-pointer-pairs-subtract-errors.cpp:[[@LINE+1]] foo(heap1, &global1[0]); // CHECK: ERROR: AddressSanitizer: invalid-pointer-pair - // CHECK: #{{[0-9]+ .*}} in main {{.*}}invalid-pointer-pairs-subtract-errors.cpp:[[@LINE+1]] + // CHECK: #{{[0-9]+ .*}} in {{main|.main}} {{.*}}invalid-pointer-pairs-subtract-errors.cpp:[[@LINE+1]] foo(&stack1, &global1[0]); free(heap1); diff --git a/compiler-rt/test/asan/TestCases/invalid-pointer-pairs.cpp b/compiler-rt/test/asan/TestCases/invalid-pointer-pairs.cpp index 061a0a7b2b861..e03fed924b527 100644 --- a/compiler-rt/test/asan/TestCases/invalid-pointer-pairs.cpp +++ b/compiler-rt/test/asan/TestCases/invalid-pointer-pairs.cpp @@ -13,10 +13,10 @@ int f(char c, char *p, char *q) { // [[PTR1:0x[0-9a-f]+]] [[PTR2:0x[0-9a-f]+]] switch (c) { case 'g': - // CMP: #{{[0-9]+ .*}} in f({{char, *char *\*, *char *\*}}) {{.*}}invalid-pointer-pairs.cpp:[[@LINE+1]] + // CMP: #{{[0-9]+ .*}} in {{\.?f}}({{char, *char *\*, *char *\*}}) {{.*}}invalid-pointer-pairs.cpp:[[@LINE+1]] return p > q; case 's': - // SUB: #{{[0-9]+ .*}} in f({{char, *char *\*, *char *\*}}) {{.*}}invalid-pointer-pairs.cpp:[[@LINE+1]] + // SUB: #{{[0-9]+ .*}} in {{\.?f}}({{char, *char *\*, *char *\*}}) {{.*}}invalid-pointer-pairs.cpp:[[@LINE+1]] return p - q; case 'k': { // OK-NOT: ERROR @@ -26,7 +26,7 @@ int f(char c, char *p, char *q) { case 'f': { char *p3 = p + 20; free(p); - // FREE: #{{[0-9]+ .*}} in f({{char, *char *\*, *char *\*}}) {{.*}}invalid-pointer-pairs.cpp:[[@LINE+2]] + // FREE: #{{[0-9]+ .*}} in {{\.?f}}({{char, *char *\*, *char *\*}}) {{.*}}invalid-pointer-pairs.cpp:[[@LINE+2]] // FREE: freed by thread return p < p3; } diff --git a/compiler-rt/test/asan/TestCases/large_func_test.cpp b/compiler-rt/test/asan/TestCases/large_func_test.cpp index 1c25d345cb5c4..a0ab0a2379fe2 100644 --- a/compiler-rt/test/asan/TestCases/large_func_test.cpp +++ b/compiler-rt/test/asan/TestCases/large_func_test.cpp @@ -33,6 +33,7 @@ static void LargeFunction(int *x, int zero) { // CHECK-Windows:{{#[0-1] 0x.* in LargeFunction.*large_func_test.cpp:}}[[@LINE-5]] // CHECK-FreeBSD:{{#0 0x.* in LargeFunction.*large_func_test.cpp:}}[[@LINE-6]] // CHECK-Darwin: {{#0 0x.* in .*LargeFunction.*large_func_test.cpp}}:[[@LINE-7]] + // CHECK-AIX: {{#0 0x.* in .*LargeFunction.*large_func_test.cpp}}:[[@LINE-8]] x[10]++; x[11]++; @@ -49,7 +50,7 @@ static void LargeFunction(int *x, int zero) { int main(int argc, char **argv) { int *x = new int[100]; LargeFunction(x, argc - 1); - // CHECK: {{ #[1-2] 0x.* in main .*large_func_test.cpp:}}[[@LINE-1]] + // CHECK: {{ #[1-2] 0x.* in \.?main .*large_func_test.cpp:}}[[@LINE-1]] // CHECK: {{0x.* is located 12 bytes after 400-byte region}} // CHECK: {{allocated by thread T0 here:}} // CHECK-Linux: {{ #0 0x.* in operator new}} @@ -57,7 +58,10 @@ int main(int argc, char **argv) { // CHECK-Windows:{{ #0 0x.* in operator new}} // CHECK-FreeBSD:{{ #0 0x.* in operator new}} // CHECK-Darwin: {{ #0 0x.* in .*_Zna}} - // CHECK-NEXT: {{ #1 0x.* in main .*large_func_test.cpp:}}[[@LINE-10]] + // AIX currently have some issue while symbolizing operator new. + // FIXME: fix this symbolizer issue on aix. + // CHECK-AIX: {{ #0 0x.* }} + // CHECK-NEXT: {{ #1 0x.* in \.main? .*large_func_test.cpp:}}[[@LINE-13]] int y = x[argc]; delete[] x; return y; diff --git a/compiler-rt/test/asan/TestCases/malloc-size-too-big.cpp b/compiler-rt/test/asan/TestCases/malloc-size-too-big.cpp index 771640a4ac08d..79a19b3dd7bdc 100644 --- a/compiler-rt/test/asan/TestCases/malloc-size-too-big.cpp +++ b/compiler-rt/test/asan/TestCases/malloc-size-too-big.cpp @@ -18,7 +18,7 @@ int main() { void *p = malloc(kMaxAllowedMallocSizePlusOne); // CHECK: {{ERROR: AddressSanitizer: requested allocation size .* \(.* after adjustments for alignment, red zones etc\.\) exceeds maximum supported size}} // CHECK: {{#0 0x.* in .*malloc}} - // CHECK: {{#[1-3] 0x.* in main .*malloc-size-too-big.cpp:}}[[@LINE-3]] + // CHECK: {{#[1-3] 0x.* in \.?main .*malloc-size-too-big.cpp:}}[[@LINE-3]] // CHECK: SUMMARY: AddressSanitizer: allocation-size-too-big printf("malloc returned: %zu\n", (size_t)p); diff --git a/compiler-rt/test/asan/TestCases/malloc_context_size.cpp b/compiler-rt/test/asan/TestCases/malloc_context_size.cpp index e75bc48793ad1..5cc00578ca6f8 100644 --- a/compiler-rt/test/asan/TestCases/malloc_context_size.cpp +++ b/compiler-rt/test/asan/TestCases/malloc_context_size.cpp @@ -11,17 +11,19 @@ int main() { return x[0]; // CHECK: freed by thread T{{.*}} here: - // CHECK-NEXT: #0 0x{{.*}} in {{operator delete( )?\[\]|_ZdaPv}} + // FIXME: aix currently can not symbolize operator delete inside asan library. + // CHECK-NEXT: #0 0x{{.*}} {{(in operator delete( )?\[\]|wrap__ZdaPv|.*)}} // CHECK-NOT: #1 0x{{.*}} // CHECK: previously allocated by thread T{{.*}} here: - // CHECK-NEXT: #0 0x{{.*}} in {{operator new( )?\[\]|_Znam}} + // FIXME: aix currently can not symbolize operator delete inside asan library. + // CHECK-NEXT: #0 0x{{.*}} {{(in operator new( )?\[\]|wrap__Znam|.*)}} // CHECK-NOT: #1 0x{{.*}} // CHECK: SUMMARY: AddressSanitizer: heap-use-after-free // TWO: previously allocated by thread T{{.*}} here: // TWO-NEXT: #0 0x{{.*}} - // TWO-NEXT: #1 0x{{.*}} in main {{.*}}malloc_context_size.cpp + // TWO-NEXT: #1 0x{{.*}} in {{\.?main}} {{.*}}malloc_context_size.cpp // TWO: SUMMARY: AddressSanitizer: heap-use-after-free } diff --git a/compiler-rt/test/asan/TestCases/memset_test.cpp b/compiler-rt/test/asan/TestCases/memset_test.cpp index 0530c8483d72f..7c3a3064e76f3 100644 --- a/compiler-rt/test/asan/TestCases/memset_test.cpp +++ b/compiler-rt/test/asan/TestCases/memset_test.cpp @@ -9,26 +9,28 @@ // RUN: %clangxx_asan -O3 -DTEST_MEMSET %s -o %t && not %run %t 2>&1 | \ // RUN: FileCheck %s --check-prefix=CHECK-MEMSET -// RUN: %clangxx_asan -O0 -DTEST_MEMCPY %s -o %t && not %run %t 2>&1 | \ -// RUN: FileCheck %s --check-prefix=CHECK-MEMCPY -// RUN: %clangxx_asan -O1 -DTEST_MEMCPY %s -o %t && not %run %t 2>&1 | \ -// RUN: FileCheck %s --check-prefix=CHECK-MEMCPY -// RUN: %clangxx_asan -O2 -DTEST_MEMCPY %s -o %t && not %run %t 2>&1 | \ -// RUN: FileCheck %s --check-prefix=CHECK-MEMCPY -// RUN: %clangxx_asan -O3 -DTEST_MEMCPY %s -o %t && not %run %t 2>&1 | \ -// RUN: FileCheck %s --check-prefix=CHECK-MEMCPY +// AIX can not intercept memcpy +// RUN: %if !target={{.*aix.*}} %{ %clangxx_asan -O0 -DTEST_MEMCPY %s -o %t && not %run %t 2>&1 | \ +// RUN: FileCheck %s --check-prefix=CHECK-MEMCPY %} +// RUN: %if !target={{.*aix.*}} %{ %clangxx_asan -O1 -DTEST_MEMCPY %s -o %t && not %run %t 2>&1 | \ +// RUN: FileCheck %s --check-prefix=CHECK-MEMCPY %} +// RUN: %if !target={{.*aix.*}} %{ %clangxx_asan -O2 -DTEST_MEMCPY %s -o %t && not %run %t 2>&1 | \ +// RUN: FileCheck %s --check-prefix=CHECK-MEMCPY %} +// RUN: %if !target={{.*aix.*}} %{ %clangxx_asan -O3 -DTEST_MEMCPY %s -o %t && not %run %t 2>&1 | \ +// RUN: FileCheck %s --check-prefix=CHECK-MEMCPY %} -// RUN: %clangxx_asan -O0 -DTEST_MEMMOVE %s -o %t && not %run %t 2>&1 | \ -// RUN: FileCheck %s --check-prefix=CHECK-MEMMOVE -// RUN: %clangxx_asan -O1 -DTEST_MEMMOVE %s -o %t && not %run %t 2>&1 | \ -// RUN: FileCheck %s --check-prefix=CHECK-MEMMOVE -// RUN: %clangxx_asan -O2 -DTEST_MEMMOVE %s -o %t && not %run %t 2>&1 | \ -// RUN: FileCheck %s --check-prefix=CHECK-MEMMOVE -// RUN: %clangxx_asan -O3 -DTEST_MEMMOVE %s -o %t && not %run %t 2>&1 | \ -// RUN: FileCheck %s --check-prefix=CHECK-MEMMOVE +// AIX can not intercept memmove +// RUN: %if !target={{.*aix.*}} %{ %clangxx_asan -O0 -DTEST_MEMMOVE %s -o %t && not %run %t 2>&1 | \ +// RUN: FileCheck %s --check-prefix=CHECK-MEMMOVE %} +// RUN: %if !target={{.*aix.*}} %{ %clangxx_asan -O1 -DTEST_MEMMOVE %s -o %t && not %run %t 2>&1 | \ +// RUN: FileCheck %s --check-prefix=CHECK-MEMMOVE %} +// RUN: %if !target={{.*aix.*}} %{ %clangxx_asan -O2 -DTEST_MEMMOVE %s -o %t && not %run %t 2>&1 | \ +// RUN: FileCheck %s --check-prefix=CHECK-MEMMOVE %} +// RUN: %if !target={{.*aix.*}} %{ %clangxx_asan -O3 -DTEST_MEMMOVE %s -o %t && not %run %t 2>&1 | \ +// RUN: FileCheck %s --check-prefix=CHECK-MEMMOVE %} -// RUN: %clangxx_asan -O2 -DTEST_MEMCPY_SIZE_OVERFLOW %s -o %t && not %run %t 2>&1 | \ -// RUN: FileCheck %s --check-prefix=CHECK-MEMCPY_SIZE_OVERFLOW +// RUN: %if !target={{.*aix.*}} %{ %clangxx_asan -O2 -DTEST_MEMCPY_SIZE_OVERFLOW %s -o %t && not %run %t 2>&1 | \ +// RUN: FileCheck %s --check-prefix=CHECK-MEMCPY_SIZE_OVERFLOW %} #include #include diff --git a/compiler-rt/test/asan/TestCases/null_deref.cpp b/compiler-rt/test/asan/TestCases/null_deref.cpp index 3ccb475326369..54c1b14f11e23 100644 --- a/compiler-rt/test/asan/TestCases/null_deref.cpp +++ b/compiler-rt/test/asan/TestCases/null_deref.cpp @@ -21,6 +21,6 @@ void NullDeref(int *ptr) { } int main() { NullDeref((int*)0); - // CHECK: {{ #1 0x.* in main.*null_deref.cpp}} + // CHECK: {{ #1 0x.* in \.?main.*null_deref.cpp}} // CHECK: AddressSanitizer can not provide additional info. } diff --git a/compiler-rt/test/asan/TestCases/print_summary.cpp b/compiler-rt/test/asan/TestCases/print_summary.cpp index f3f7697056eab..d73e0fd49a892 100644 --- a/compiler-rt/test/asan/TestCases/print_summary.cpp +++ b/compiler-rt/test/asan/TestCases/print_summary.cpp @@ -8,7 +8,7 @@ int main() { delete[] x; return x[0]; // SOURCE: ERROR: AddressSanitizer: heap-use-after-free - // SOURCE: SUMMARY: AddressSanitizer: heap-use-after-free {{.*}}print_summary.cpp:[[@LINE-2]]{{.*}} main + // SOURCE: SUMMARY: AddressSanitizer: heap-use-after-free {{.*}}print_summary.cpp:[[@LINE-2]]{{.*}} {{\.?main}} // MODULE: ERROR: AddressSanitizer: heap-use-after-free // MODULE: SUMMARY: AddressSanitizer: heap-use-after-free ({{.*}}+0x{{.*}}) // MISSING: ERROR: AddressSanitizer: heap-use-after-free diff --git a/compiler-rt/test/asan/TestCases/replaceable_new_delete_shared.cpp b/compiler-rt/test/asan/TestCases/replaceable_new_delete_shared.cpp index 6a78ebb3489b9..5302c3d71a108 100644 --- a/compiler-rt/test/asan/TestCases/replaceable_new_delete_shared.cpp +++ b/compiler-rt/test/asan/TestCases/replaceable_new_delete_shared.cpp @@ -3,7 +3,8 @@ // FIXME: Weak symbols aren't supported on Windows, although some code in // compiler-rt already exists to solve this problem. We should probably define // the new/delete interceptors as "weak" using those workarounds as well. -// UNSUPPORTED: target={{.*windows.*}} +// AIX does not support shared sanitizer libraries. +// UNSUPPORTED: target={{.*(windows|aix).*}} // RUN: %clangxx %s -o %t -fsanitize=address -shared-libsan && not %run %t 2>&1 | FileCheck %s diff --git a/compiler-rt/test/asan/TestCases/set_shadow_test.c b/compiler-rt/test/asan/TestCases/set_shadow_test.c index f1c96502eba7e..39368ae3d3188 100644 --- a/compiler-rt/test/asan/TestCases/set_shadow_test.c +++ b/compiler-rt/test/asan/TestCases/set_shadow_test.c @@ -32,7 +32,11 @@ void f(long arg) { size_t shadow_offset; size_t shadow_scale; __asan_get_shadow_mapping(&shadow_scale, &shadow_offset); +#if !defined(__LP64__) || !defined(_AIX) size_t addr = (((size_t)a) >> shadow_scale) + shadow_offset; +#else + size_t addr = (((size_t)a << 6) >> (6 + shadow_scale)) + shadow_offset; +#endif switch (arg) { // X00-NOT: AddressSanitizer diff --git a/compiler-rt/test/asan/TestCases/stack-buffer-overflow.cpp b/compiler-rt/test/asan/TestCases/stack-buffer-overflow.cpp index 07cf39433b458..31dfaed32b457 100644 --- a/compiler-rt/test/asan/TestCases/stack-buffer-overflow.cpp +++ b/compiler-rt/test/asan/TestCases/stack-buffer-overflow.cpp @@ -9,7 +9,7 @@ int main(int argc, char **argv) { memset(x, 0, 10); int res = x[argc * 10]; // BOOOM // CHECK: {{READ of size 1 at 0x.* thread T0}} - // CHECK: {{ #0 0x.* in main .*stack-buffer-overflow.cpp:}}[[@LINE-2]] + // CHECK: {{ #0 0x.* in \.?main .*stack-buffer-overflow.cpp:}}[[@LINE-2]] // CHECK: {{Address 0x.* is located in stack of thread T0 at offset}} // CHECK-NEXT: in{{.*}}main{{.*}}stack-buffer-overflow.cpp return res; diff --git a/compiler-rt/test/asan/TestCases/strcasestr-1.c b/compiler-rt/test/asan/TestCases/strcasestr-1.c index 9fa4a2b31b97f..832178378ab30 100644 --- a/compiler-rt/test/asan/TestCases/strcasestr-1.c +++ b/compiler-rt/test/asan/TestCases/strcasestr-1.c @@ -8,6 +8,9 @@ // There's no interceptor for strcasestr on Windows // XFAIL: target={{.*windows-(msvc.*|gnu)}} +// AIX does not define strcasestr +// UNSUPPORTED: target={{.*aix.*}} + #define _GNU_SOURCE #include #include diff --git a/compiler-rt/test/asan/TestCases/strcasestr-2.c b/compiler-rt/test/asan/TestCases/strcasestr-2.c index 920d11e275c6a..2f530cda44484 100644 --- a/compiler-rt/test/asan/TestCases/strcasestr-2.c +++ b/compiler-rt/test/asan/TestCases/strcasestr-2.c @@ -8,6 +8,9 @@ // There's no interceptor for strcasestr on Windows // XFAIL: target={{.*windows-(msvc.*|gnu)}} +// AIX does not define strcasestr. +// UNSUPPORTED: target={{.*aix.*}} + #define _GNU_SOURCE #include #include diff --git a/compiler-rt/test/asan/TestCases/strcasestr_strict.c b/compiler-rt/test/asan/TestCases/strcasestr_strict.c index 16efae72ada4e..268e63860242d 100644 --- a/compiler-rt/test/asan/TestCases/strcasestr_strict.c +++ b/compiler-rt/test/asan/TestCases/strcasestr_strict.c @@ -6,6 +6,9 @@ // There's no interceptor for strcasestr on Windows // XFAIL: target={{.*windows-(msvc.*|gnu)}} +// AIX does not define strcasestr. +// UNSUPPORTED: target={{.*aix.*}} + #define _GNU_SOURCE #include #include diff --git a/compiler-rt/test/asan/TestCases/strcat_strict.c b/compiler-rt/test/asan/TestCases/strcat_strict.c index 6e9bd8eb08602..55324624f3238 100644 --- a/compiler-rt/test/asan/TestCases/strcat_strict.c +++ b/compiler-rt/test/asan/TestCases/strcat_strict.c @@ -7,6 +7,9 @@ // RUN: %env_asan_opts=strict_string_checks=false not %run %t test2 2>&1 | FileCheck %s --check-prefix=CHECK2-NONSTRICT --check-prefix=CHECK2 // RUN: %env_asan_opts=strict_string_checks=true not %run %t test2 2>&1 | FileCheck %s --check-prefix=CHECK2-STRICT --check-prefix=CHECK2 +// AIX does not intercept strcat. +// UNSUPPORTED: target={{.*aix.*}} + #include #include #include diff --git a/compiler-rt/test/asan/TestCases/strcmp.c b/compiler-rt/test/asan/TestCases/strcmp.c index 417bd491ebe02..eba27d2cfa77b 100644 --- a/compiler-rt/test/asan/TestCases/strcmp.c +++ b/compiler-rt/test/asan/TestCases/strcmp.c @@ -3,6 +3,9 @@ // RUN: %env_asan_opts=intercept_strcmp=true not %run %t 2>&1 | FileCheck %s // RUN: not %run %t 2>&1 | FileCheck %s +// AIX does not intercept strcmp. +//UNSUPPORTED: target={{.*aix.*}} + #include #include #include diff --git a/compiler-rt/test/asan/TestCases/strcmp_strict.c b/compiler-rt/test/asan/TestCases/strcmp_strict.c index e168923749ce2..654cccd4dc5ac 100644 --- a/compiler-rt/test/asan/TestCases/strcmp_strict.c +++ b/compiler-rt/test/asan/TestCases/strcmp_strict.c @@ -3,6 +3,9 @@ // RUN: %env_asan_opts=strict_string_checks=false %run %t 2>&1 // RUN: %env_asan_opts=strict_string_checks=true not %run %t 2>&1 | FileCheck %s +// AIX does not intercept strcmp. +// UNSUPPORTED: target={{.*aix.*}} + #include #include #include diff --git a/compiler-rt/test/asan/TestCases/strcpy-overlap.cpp b/compiler-rt/test/asan/TestCases/strcpy-overlap.cpp index 89ac7a39b33ca..5bc50d806a920 100644 --- a/compiler-rt/test/asan/TestCases/strcpy-overlap.cpp +++ b/compiler-rt/test/asan/TestCases/strcpy-overlap.cpp @@ -28,6 +28,9 @@ // UNSUPPORTED: android, MSVC +// AIX does not intercept strcpy +// UNSUPPORTED: target={{.*aix.*}} + #include "defines.h" #include diff --git a/compiler-rt/test/asan/TestCases/strip_path_prefix.c b/compiler-rt/test/asan/TestCases/strip_path_prefix.c index e77f1d5ddaf42..e58f9e3b784c6 100644 --- a/compiler-rt/test/asan/TestCases/strip_path_prefix.c +++ b/compiler-rt/test/asan/TestCases/strip_path_prefix.c @@ -8,5 +8,5 @@ int main() { return x[5]; // Check that paths in error report don't start with slash. // CHECK: heap-use-after-free - // CHECK: #0 0x{{.*}} in main {{.*}}strip_path_prefix.c:[[@LINE-3]] + // CHECK: #0 0x{{.*}} in {{\.?main}} {{.*}}strip_path_prefix.c:[[@LINE-3]] } diff --git a/compiler-rt/test/asan/TestCases/strncat-overlap.cpp b/compiler-rt/test/asan/TestCases/strncat-overlap.cpp index e4f2fbca68abf..ef2e96dda1d87 100644 --- a/compiler-rt/test/asan/TestCases/strncat-overlap.cpp +++ b/compiler-rt/test/asan/TestCases/strncat-overlap.cpp @@ -28,6 +28,9 @@ // UNSUPPORTED: android +// AIX does not intercept strncat. +// UNSUPPORTED: target={{.*aix.*}} + #include "defines.h" #include diff --git a/compiler-rt/test/asan/TestCases/strncat_strict.c b/compiler-rt/test/asan/TestCases/strncat_strict.c index 2b44b565a5e4f..2f61af491536e 100644 --- a/compiler-rt/test/asan/TestCases/strncat_strict.c +++ b/compiler-rt/test/asan/TestCases/strncat_strict.c @@ -7,6 +7,9 @@ // RUN: %env_asan_opts=strict_string_checks=false not %run %t test2 2>&1 | FileCheck %s --check-prefix=CHECK2-NONSTRICT --check-prefix=CHECK2 // RUN: %env_asan_opts=strict_string_checks=true not %run %t test2 2>&1 | FileCheck %s --check-prefix=CHECK2-STRICT --check-prefix=CHECK2 +// aix does not intercept strncat. +// UNSUPPORTED: target={{.*aix.*}} + #include #include #include diff --git a/compiler-rt/test/asan/TestCases/strncmp_strict.c b/compiler-rt/test/asan/TestCases/strncmp_strict.c index e06d1475b96f5..35bda6f7df020 100644 --- a/compiler-rt/test/asan/TestCases/strncmp_strict.c +++ b/compiler-rt/test/asan/TestCases/strncmp_strict.c @@ -14,6 +14,9 @@ // RUN: %env_asan_opts=strict_string_checks=false %run %t i 2>&1 // RUN: %env_asan_opts=strict_string_checks=true not %run %t i 2>&1 | FileCheck %s +// AIX does not intercept strncmp. +// UNSUPPORTED: target={{.*aix.*}} + #include #include #include diff --git a/compiler-rt/test/asan/TestCases/strncpy-overflow.cpp b/compiler-rt/test/asan/TestCases/strncpy-overflow.cpp index f75f8c5eb3ff6..db7a4a119cee4 100644 --- a/compiler-rt/test/asan/TestCases/strncpy-overflow.cpp +++ b/compiler-rt/test/asan/TestCases/strncpy-overflow.cpp @@ -6,6 +6,9 @@ // REQUIRES: compiler-rt-optimized // REQUIRES: stable-runtime +// AIX does not intercept strncpy. +// UNSUPPORTED: target={{.*aix.*}} + #include "defines.h" #include #include diff --git a/compiler-rt/test/asan/TestCases/strncpy-overlap.cpp b/compiler-rt/test/asan/TestCases/strncpy-overlap.cpp index 9334a333c052a..8962747816d75 100644 --- a/compiler-rt/test/asan/TestCases/strncpy-overlap.cpp +++ b/compiler-rt/test/asan/TestCases/strncpy-overlap.cpp @@ -28,6 +28,9 @@ // UNSUPPORTED: android +// AIX does not intercept strncpy. +// UNSUPPORTED: target={{.*aix.*}} + #include "defines.h" #include diff --git a/compiler-rt/test/asan/TestCases/suppressions-library.cpp b/compiler-rt/test/asan/TestCases/suppressions-library.cpp index 5427122eaa92f..d8fa0f6fc7517 100644 --- a/compiler-rt/test/asan/TestCases/suppressions-library.cpp +++ b/compiler-rt/test/asan/TestCases/suppressions-library.cpp @@ -12,6 +12,11 @@ // FIXME: Upload suppressions to device. // XFAIL: android +// For this case, crash_function(which calls malloc/free) is compiled to a shared library, +// However intercepting symbols in a shared library is still unsupported. + +// UNSUPPORTED: target={{.*aix.*}} + #include #include #include diff --git a/compiler-rt/test/asan/TestCases/use-after-delete.cpp b/compiler-rt/test/asan/TestCases/use-after-delete.cpp index 4d0c055368bb0..340eefbe8b5e6 100644 --- a/compiler-rt/test/asan/TestCases/use-after-delete.cpp +++ b/compiler-rt/test/asan/TestCases/use-after-delete.cpp @@ -4,6 +4,9 @@ // RUN: %clangxx_asan -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os --check-prefix=CHECK // REQUIRES: stable-runtime +// AIX currently have some issue while symbolizing operator new/delete. +// FIXME: fix this symbolizer issue on aix. + #include int main() { char * volatile x = new char[10]; @@ -12,7 +15,7 @@ int main() { // CHECK: {{.*ERROR: AddressSanitizer: heap-use-after-free on address}} // CHECK: {{0x.* at pc 0x.* bp 0x.* sp 0x.*}} // CHECK: {{READ of size 1 at 0x.* thread T0}} - // CHECK: {{ #0 0x.* in main .*use-after-delete.cpp:}}[[@LINE-4]] + // CHECK: {{ #0 0x.* in \.?main .*use-after-delete.cpp:}}[[@LINE-4]] // CHECK: {{0x.* is located 5 bytes inside of 10-byte region .0x.*,0x.*}} // CHECK: {{freed by thread T0 here:}} @@ -21,7 +24,8 @@ int main() { // CHECK-Windows:{{ #0 0x.* in operator delete\[\]}} // CHECK-FreeBSD:{{ #0 0x.* in operator delete\[\]}} // CHECK-Darwin: {{ #0 0x.* in .*_Zda}} - // CHECK-NEXT: {{ #1 0x.* in main .*use-after-delete.cpp:}}[[@LINE-14]] + // CHECK-AIX: {{ #0 0x.*}} + // CHECK-NEXT: {{ #1 0x.* in \.?main .*use-after-delete.cpp:}}[[@LINE-15]] // CHECK: {{previously allocated by thread T0 here:}} // CHECK-Linux: {{ #0 0x.* in operator new\[\]}} @@ -29,8 +33,8 @@ int main() { // CHECK-Windows:{{ #0 0x.* in operator new\[\]}} // CHECK-FreeBSD:{{ #0 0x.* in operator new\[\]}} // CHECK-Darwin: {{ #0 0x.* in .*_Zna}} - // CHECK-NEXT: {{ #1 0x.* in main .*use-after-delete.cpp:}}[[@LINE-23]] - + // CHECK-AIX: {{ #0 0x.*}} + // CHECK-NEXT: {{ #1 0x.* in \.?main .*use-after-delete.cpp:}}[[@LINE-25]] // CHECK: Shadow byte legend (one shadow byte represents {{[0-9]+}} application bytes): // CHECK: Global redzone: diff --git a/compiler-rt/test/asan/TestCases/use-after-free-right.cpp b/compiler-rt/test/asan/TestCases/use-after-free-right.cpp index 11011e4b4fb1a..2211d52dbdc7e 100644 --- a/compiler-rt/test/asan/TestCases/use-after-free-right.cpp +++ b/compiler-rt/test/asan/TestCases/use-after-free-right.cpp @@ -15,13 +15,13 @@ int main() { // CHECK: {{.*ERROR: AddressSanitizer: heap-use-after-free on address}} // CHECK: {{0x.* at pc 0x.* bp 0x.* sp 0x.*}} // CHECK: {{WRITE of size 1 at 0x.* thread T0}} - // CHECK: {{ #0 0x.* in main .*use-after-free-right.cpp:}}[[@LINE-4]] + // CHECK: {{ #0 0x.* in \.?main .*use-after-free-right.cpp:}}[[@LINE-4]] // CHECK: {{0x.* is located 0 bytes inside of 1-byte region .0x.*,0x.*}} // CHECK: {{freed by thread T0 here:}} // CHECK: {{ #0 0x.* in .*free}} - // CHECK: {{ #[1-3] 0x.* in main .*use-after-free-right.cpp:}}[[@LINE-9]] + // CHECK: {{ #[1-3] 0x.* in \.?main .*use-after-free-right.cpp:}}[[@LINE-9]] // CHECK: {{previously allocated by thread T0 here:}} // CHECK: {{ #0 0x.* in .*malloc}} - // CHECK: {{ #[1-3] 0x.* in main .*use-after-free-right.cpp:}}[[@LINE-14]] + // CHECK: {{ #[1-3] 0x.* in \.?main .*use-after-free-right.cpp:}}[[@LINE-14]] } diff --git a/compiler-rt/test/asan/TestCases/use-after-free.cpp b/compiler-rt/test/asan/TestCases/use-after-free.cpp index f19c461960d36..af118648fb842 100644 --- a/compiler-rt/test/asan/TestCases/use-after-free.cpp +++ b/compiler-rt/test/asan/TestCases/use-after-free.cpp @@ -12,15 +12,15 @@ int main() { // CHECK: {{.*ERROR: AddressSanitizer: heap-use-after-free on address}} // CHECK: {{0x.* at pc 0x.* bp 0x.* sp 0x.*}} // CHECK: {{READ of size 1 at 0x.* thread T0}} - // CHECK: {{ #0 0x.* in main .*use-after-free.cpp:}}[[@LINE-4]] + // CHECK: {{ #0 0x.* in \.?main .*use-after-free.cpp:}}[[@LINE-4]] // CHECK: {{0x.* is located 5 bytes inside of 10-byte region .0x.*,0x.*}} // CHECK: {{freed by thread T0 here:}} // CHECK: {{ #0 0x.* in .*free}} - // CHECK: {{ #[1-3] 0x.* in main .*use-after-free.cpp:}}[[@LINE-9]] + // CHECK: {{ #[1-3] 0x.* in \.?main .*use-after-free.cpp:}}[[@LINE-9]] // CHECK: {{previously allocated by thread T0 here:}} // CHECK: {{ #0 0x.* in .*malloc}} - // CHECK: {{ #[1-3] 0x.* in main .*use-after-free.cpp:}}[[@LINE-14]] + // CHECK: {{ #[1-3] 0x.* in \.?main .*use-after-free.cpp:}}[[@LINE-14]] // CHECK: Shadow byte legend (one shadow byte represents {{[0-9]+}} application bytes): // CHECK: Global redzone: // CHECK: ASan internal: diff --git a/compiler-rt/test/asan/TestCases/use-after-scope-dtor-order.cpp b/compiler-rt/test/asan/TestCases/use-after-scope-dtor-order.cpp index c4a188d2c86ce..cf54ededc971f 100644 --- a/compiler-rt/test/asan/TestCases/use-after-scope-dtor-order.cpp +++ b/compiler-rt/test/asan/TestCases/use-after-scope-dtor-order.cpp @@ -8,7 +8,7 @@ struct IntHolder { ATTRIBUTE_NOINLINE ~IntHolder() { printf("Value: %d\n", *val_); // BOOM // CHECK: ERROR: AddressSanitizer: stack-use-after-scope - // CHECK: #0 0x{{.*}} in IntHolder::~IntHolder{{.*}}.cpp:[[@LINE-2]] + // CHECK: #0 0x{{.*}} in {{\.?IntHolder::~IntHolder.*}}.cpp:[[@LINE-2]] } void set(int *val) { val_ = val; } int *get() { return val_; } diff --git a/compiler-rt/test/asan/TestCases/use-after-scope-if.cpp b/compiler-rt/test/asan/TestCases/use-after-scope-if.cpp index 4c6cf34eaa9fd..658aa746a5b15 100644 --- a/compiler-rt/test/asan/TestCases/use-after-scope-if.cpp +++ b/compiler-rt/test/asan/TestCases/use-after-scope-if.cpp @@ -10,5 +10,5 @@ int main() { } return *p; // BOOM // CHECK: ERROR: AddressSanitizer: stack-use-after-scope - // CHECK: #0 0x{{.*}} in main {{.*}}.cpp:[[@LINE-2]] + // CHECK: #0 0x{{.*}} in {{\.?main}} {{.*}}.cpp:[[@LINE-2]] } diff --git a/compiler-rt/test/asan/TestCases/use-after-scope-inlined.cpp b/compiler-rt/test/asan/TestCases/use-after-scope-inlined.cpp index fdb6b9868102d..99187d931697e 100644 --- a/compiler-rt/test/asan/TestCases/use-after-scope-inlined.cpp +++ b/compiler-rt/test/asan/TestCases/use-after-scope-inlined.cpp @@ -22,10 +22,10 @@ int main(int argc, char *argv[]) { return arr[argc - 1]; // BOOM // CHECK: ERROR: AddressSanitizer: stack-use-after-scope // CHECK: READ of size 4 at 0x{{.*}} thread T0 - // CHECK: #0 0x{{.*}} in main + // CHECK: #0 0x{{.*}} in {{\.?main}} // CHECK: {{.*}}use-after-scope-inlined.cpp:[[@LINE-4]] // CHECK: Address 0x{{.*}} is located in stack of thread T0 at offset [[OFFSET:[^ ]*]] in frame - // CHECK: {{.*}} in main + // CHECK: {{.*}} in {{\.?main}} // CHECK: This frame has // CHECK: {{\[}}[[OFFSET]], {{.*}}) 'x' (line [[@LINE-15]]) } diff --git a/compiler-rt/test/asan/TestCases/use-after-scope-loop-bug.cpp b/compiler-rt/test/asan/TestCases/use-after-scope-loop-bug.cpp index b97fe6730ddc4..2b26209736b8d 100644 --- a/compiler-rt/test/asan/TestCases/use-after-scope-loop-bug.cpp +++ b/compiler-rt/test/asan/TestCases/use-after-scope-loop-bug.cpp @@ -10,7 +10,7 @@ int main() { } return *p; // BOOM // CHECK: ERROR: AddressSanitizer: stack-use-after-scope - // CHECK: #0 0x{{.*}} in main {{.*}}use-after-scope-loop-bug.cpp:[[@LINE-2]] + // CHECK: #0 0x{{.*}} in {{\.?main}} {{.*}}use-after-scope-loop-bug.cpp:[[@LINE-2]] // CHECK: Address 0x{{.*}} is located in stack of thread T{{.*}} at offset [[OFFSET:[^ ]+]] in frame // {{\[}}[[OFFSET]], {{[0-9]+}}) 'x' } diff --git a/compiler-rt/test/asan/TestCases/use-after-scope-loop-removed.cpp b/compiler-rt/test/asan/TestCases/use-after-scope-loop-removed.cpp index 8fedceb6cf330..88876e8bfb911 100644 --- a/compiler-rt/test/asan/TestCases/use-after-scope-loop-removed.cpp +++ b/compiler-rt/test/asan/TestCases/use-after-scope-loop-removed.cpp @@ -12,7 +12,7 @@ int main() { } return *p; // BOOM // CHECK: ERROR: AddressSanitizer: stack-use-after-scope - // CHECK: #0 0x{{.*}} in main {{.*}}use-after-scope-loop-removed.cpp:[[@LINE-2]] + // CHECK: #0 0x{{.*}} in {{\.?main}} {{.*}}use-after-scope-loop-removed.cpp:[[@LINE-2]] // CHECK: Address 0x{{.*}} is located in stack of thread T{{.*}} at offset [[OFFSET:[^ ]+]] in frame // {{\[}}[[OFFSET]], {{[0-9]+}}) 'x' } diff --git a/compiler-rt/test/asan/TestCases/use-after-scope-loop.cpp b/compiler-rt/test/asan/TestCases/use-after-scope-loop.cpp index 7254a785995b7..b1fa563eb1750 100644 --- a/compiler-rt/test/asan/TestCases/use-after-scope-loop.cpp +++ b/compiler-rt/test/asan/TestCases/use-after-scope-loop.cpp @@ -10,5 +10,5 @@ int main() { } return **p; // BOOM // CHECK: ERROR: AddressSanitizer: stack-use-after-scope - // CHECK: #0 0x{{.*}} in main {{.*}}.cpp:[[@LINE-2]] + // CHECK: #0 0x{{.*}} in {{\.?main}} {{.*}}.cpp:[[@LINE-2]] } diff --git a/compiler-rt/test/asan/TestCases/use-after-scope-temp.cpp b/compiler-rt/test/asan/TestCases/use-after-scope-temp.cpp index ab14e14e485d9..cb299d071eb6c 100644 --- a/compiler-rt/test/asan/TestCases/use-after-scope-temp.cpp +++ b/compiler-rt/test/asan/TestCases/use-after-scope-temp.cpp @@ -14,6 +14,6 @@ int main(int argc, char *argv[]) { save({argc}); int x = saved->val; // BOOM // CHECK: ERROR: AddressSanitizer: stack-use-after-scope - // CHECK: #0 0x{{.*}} in main {{.*}}use-after-scope-temp.cpp:[[@LINE-2]] + // CHECK: #0 0x{{.*}} in {{\.?main}} {{.*}}use-after-scope-temp.cpp:[[@LINE-2]] return x; } diff --git a/compiler-rt/test/asan/TestCases/use-after-scope-temp2.cpp b/compiler-rt/test/asan/TestCases/use-after-scope-temp2.cpp index ff65f592ee208..057d0c351270d 100644 --- a/compiler-rt/test/asan/TestCases/use-after-scope-temp2.cpp +++ b/compiler-rt/test/asan/TestCases/use-after-scope-temp2.cpp @@ -14,6 +14,6 @@ int main(int argc, char *argv[]) { saved = &IntHolder().Self(); int x = saved->val; // BOOM // CHECK: ERROR: AddressSanitizer: stack-use-after-scope - // CHECK: #0 0x{{.*}} in main {{.*}}use-after-scope-temp2.cpp:[[@LINE-2]] + // CHECK: #0 0x{{.*}} in {{\.?main}} {{.*}}use-after-scope-temp2.cpp:[[@LINE-2]] return x; } diff --git a/compiler-rt/test/asan/TestCases/use-after-scope-types.cpp b/compiler-rt/test/asan/TestCases/use-after-scope-types.cpp index 3e740edfae250..b7332d4b6c0db 100644 --- a/compiler-rt/test/asan/TestCases/use-after-scope-types.cpp +++ b/compiler-rt/test/asan/TestCases/use-after-scope-types.cpp @@ -42,7 +42,7 @@ template ATTRIBUTE_NOINLINE void test() { ptr.Access(); // CHECK: ERROR: AddressSanitizer: stack-use-after-scope - // CHECK: #{{[0-9]+}} 0x{{.*}} in {{(void )?test.*\((void)?\) .*}}use-after-scope-types.cpp + // CHECK: #{{[0-9]+}} 0x{{.*}} in {{(\.?void )?test.*\((void)?\) .*}}use-after-scope-types.cpp // CHECK: Address 0x{{.*}} is located in stack of thread T{{.*}} at offset [[OFFSET:[^ ]+]] in frame // {{\[}}[[OFFSET]], {{[0-9]+}}) 'x' } diff --git a/compiler-rt/test/asan/TestCases/use-after-scope.cpp b/compiler-rt/test/asan/TestCases/use-after-scope.cpp index eb61679d2b2aa..0503b59ccf286 100644 --- a/compiler-rt/test/asan/TestCases/use-after-scope.cpp +++ b/compiler-rt/test/asan/TestCases/use-after-scope.cpp @@ -9,7 +9,7 @@ int main() { } *p = 5; // BOOM // CHECK: ERROR: AddressSanitizer: stack-use-after-scope - // CHECK: #0 0x{{.*}} in main {{.*}}use-after-scope.cpp:[[@LINE-2]] + // CHECK: #0 0x{{.*}} in {{\.?main}} {{.*}}use-after-scope.cpp:[[@LINE-2]] // CHECK: Address 0x{{.*}} is located in stack of thread T{{.*}} at offset [[OFFSET:[^ ]+]] in frame // {{\[}}[[OFFSET]], {{[0-9]+}}) 'x' return 0; diff --git a/compiler-rt/test/asan/TestCases/zero_page_pc.cpp b/compiler-rt/test/asan/TestCases/zero_page_pc.cpp index 3af4d04a587c2..2d31dd4d2051a 100644 --- a/compiler-rt/test/asan/TestCases/zero_page_pc.cpp +++ b/compiler-rt/test/asan/TestCases/zero_page_pc.cpp @@ -9,6 +9,9 @@ # include #endif +// AIX reports illegal instruction error instead of SEGV while accesses address 0x4. +// UNSUPPORTED: aix + typedef void void_f(); int main() { void_f *func = (void_f *)0x4; diff --git a/compiler-rt/test/asan/lit.cfg.py b/compiler-rt/test/asan/lit.cfg.py index 3da073332c458..88549867004e2 100644 --- a/compiler-rt/test/asan/lit.cfg.py +++ b/compiler-rt/test/asan/lit.cfg.py @@ -45,7 +45,7 @@ def get_required_attr(config, attr_name): # Setup source root. config.test_source_root = os.path.dirname(__file__) -if config.host_os not in ["FreeBSD", "NetBSD"]: +if config.host_os not in ["FreeBSD", "NetBSD", "AIX"]: libdl_flag = "-ldl" else: libdl_flag = "" @@ -323,7 +323,15 @@ def build_invocation(compile_flags, with_lto=False): config.substitutions.append(("%pie", "-pie")) # Only run the tests on supported OSs. -if config.host_os not in ["Linux", "Darwin", "FreeBSD", "SunOS", "Windows", "NetBSD"]: +if config.host_os not in [ + "Linux", + "Darwin", + "FreeBSD", + "SunOS", + "Windows", + "NetBSD", + "AIX", +]: config.unsupported = True if not config.parallelism_group: diff --git a/compiler-rt/test/lit.common.cfg.py b/compiler-rt/test/lit.common.cfg.py index 877718c703ba7..b082bdea7eb97 100644 --- a/compiler-rt/test/lit.common.cfg.py +++ b/compiler-rt/test/lit.common.cfg.py @@ -909,17 +909,35 @@ def is_windows_lto_supported(): ) ) config.substitutions.append(("%ld_flags_rpath_so" + postfix, "")) + elif config.host_os == "AIX": + config.substitutions.append( + ( + "%ld_flags_rpath_exe" + postfix, + "-L%T -l%xdynamiclib_namespec" + postfix, + ) + ) + config.substitutions.append(("%ld_flags_rpath_so" + postfix, "")) # Must be defined after the substitutions that use %dynamiclib. config.substitutions.append( ("%dynamiclib" + postfix, "%T/%xdynamiclib_filename" + postfix) ) - config.substitutions.append( - ( - "%xdynamiclib_filename" + postfix, - "lib%xdynamiclib_namespec{}.so".format(postfix), + + if config.host_os == "AIX": + config.substitutions.append( + ( + "%xdynamiclib_filename" + postfix, + "lib%xdynamiclib_namespec{}.a".format(postfix), + ) ) - ) + else: + config.substitutions.append( + ( + "%xdynamiclib_filename" + postfix, + "lib%xdynamiclib_namespec{}.so".format(postfix), + ) + ) + config.substitutions.append(("%xdynamiclib_namespec", "%basename_t.dynamic")) config.default_sanitizer_opts = [] diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/arc4random.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/arc4random.cpp index 5e95cbc331424..138c3b497d8ee 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/arc4random.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/arc4random.cpp @@ -1,6 +1,7 @@ // RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s // -// UNSUPPORTED: target={{.*(linux|solaris).*}} +// aix does not define arc4random(). +// UNSUPPORTED: target={{.*(linux|solaris|aix).*}} #include #include diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/create_thread_fail.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/create_thread_fail.cpp index 8ed9b4ccf16c2..afb412368ec85 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/create_thread_fail.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/create_thread_fail.cpp @@ -4,6 +4,9 @@ // pthread_create with lsan i386 does not fail here. // UNSUPPORTED: i386-linux && lsan +// pthread_create on AIX does not fail here. +// UNSUPPORTED: target={{.*aix.*}} + #include #include #include diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/dedup_token_length_test.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/dedup_token_length_test.cpp index deedbba76cdeb..8e2c29f8c66b2 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/dedup_token_length_test.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/dedup_token_length_test.cpp @@ -33,6 +33,6 @@ int main(int argc, char **argv) { } // CHECK0-NOT: DEDUP_TOKEN: -// CHECK1: DEDUP_TOKEN: void Xyz::Abc() -// CHECK2: DEDUP_TOKEN: void Xyz::Abc()--bar -// CHECK3: DEDUP_TOKEN: void Xyz::Abc()--bar--FOO() +// CHECK1: DEDUP_TOKEN: {{\.?void}} Xyz::Abc() +// CHECK2: DEDUP_TOKEN: {{\.?void}} Xyz::Abc()--{{\.?bar}} +// CHECK3: DEDUP_TOKEN: {{\.?void}} Xyz::Abc()--{{\.?bar}}--{{\.?FOO}}() diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/devname.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/devname.cpp index 8a34de5e31061..aaa461fe2aea0 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/devname.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/devname.cpp @@ -1,5 +1,6 @@ // RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s -// UNSUPPORTED: target={{.*(linux|solaris).*}} +// AIX does not define devname_r() +// UNSUPPORTED: target={{.*(linux|solaris|aix).*}} #include #include diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/devname_r.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/devname_r.cpp index 5f0968e2be55b..017dbdcae3fe0 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/devname_r.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/devname_r.cpp @@ -1,5 +1,6 @@ // RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s -// UNSUPPORTED: target={{.*(linux|solaris).*}} +// AIX does not define devname_r. +// UNSUPPORTED: target={{.*(linux|solaris|aix).*}} #include #include diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/fgetln.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/fgetln.cpp index 68b4ad5b887d1..59996e7d17e44 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/fgetln.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/fgetln.cpp @@ -1,6 +1,6 @@ // RUN: %clangxx -O0 -g %s -o %t && %run %t // fgetln is BSD-only. -// UNSUPPORTED: target={{.*(linux|solaris).*}} +// UNSUPPORTED: target={{.*(linux|solaris|aix).*}} #include #include diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/fseek.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/fseek.cpp index 5de879d2392e2..ee8feced542a6 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/fseek.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/fseek.cpp @@ -1,6 +1,7 @@ // RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s // -// UNSUPPORTED: darwin, target={{.*(linux|solaris).*}} +// on AIX, fail even without -fsanitize=address +// UNSUPPORTED: darwin, target={{.*(linux|solaris|aix).*}} #include #include diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/fts.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/fts.cpp index 795bc11a39e60..fbbca187ebb70 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/fts.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/fts.cpp @@ -1,6 +1,7 @@ // RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s // -// UNSUPPORTED: darwin, target={{.*(linux|solaris).*}} +// Header fts.h is not available on AIX. +// UNSUPPORTED: darwin, target={{.*(linux|solaris|aix).*}} #include #include diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/funopen.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/funopen.cpp index 052cc19dff286..2523317af529b 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/funopen.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/funopen.cpp @@ -11,7 +11,8 @@ // CHECK-NEXT: READ CALLED; len={{[0-9]*}} // CHECK-NEXT: READ: test // -// UNSUPPORTED: darwin, target={{.*(linux|solaris).*}} +// AIX does not define strlcpy. +// UNSUPPORTED: darwin, target={{.*(linux|solaris|aix).*}} #include #include diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/getcpuclockid.c b/compiler-rt/test/sanitizer_common/TestCases/Posix/getcpuclockid.c index e382cb5f714ed..6b422f6c6bdd4 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/getcpuclockid.c +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/getcpuclockid.c @@ -1,6 +1,7 @@ // RUN: %clang -pthread %s -Wl,-as-needed -o %t && %run %t // -// UNSUPPORTED: darwin, target={{.*solaris.*}} +// as-needed is not a supported linker option on AIX. +// UNSUPPORTED: darwin, target={{.*(solaris|aix).*}} #include #include diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/getfsent.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/getfsent.cpp index 8df8b5726148b..6ab3170097f7e 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/getfsent.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/getfsent.cpp @@ -1,6 +1,7 @@ // RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s // -// UNSUPPORTED: darwin, target={{.*(linux|solaris).*}} +// The usage of getfsspec() on aix is not right in this file. +// UNSUPPORTED: darwin, target={{.*(linux|solaris|aix).*}} #include #include diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/getmntinfo.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/getmntinfo.cpp index 25d6310df2fb1..4a33288b11402 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/getmntinfo.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/getmntinfo.cpp @@ -1,6 +1,7 @@ // RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s // -// UNSUPPORTED: target={{.*(linux|solaris).*}} +// AIX does not have header sys/mount.h. +// UNSUPPORTED: target={{.*(linux|solaris|aix).*}} #include diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/getpass.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/getpass.cpp index a4ca4a3c2f35d..bf8b1d9fb2fff 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/getpass.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/getpass.cpp @@ -6,7 +6,8 @@ // XFAIL: android && asan // No libutil. -// UNSUPPORTED: target={{.*solaris.*}} +// AIX does not have util.h +// UNSUPPORTED: target={{.*(solaris|aix).*}} #include #include diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/getpw_getgr.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/getpw_getgr.cpp index 848774a8909bd..6244f7825694f 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/getpw_getgr.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/getpw_getgr.cpp @@ -81,7 +81,8 @@ int main(int argc, const char *argv[]) { setgrent(); test(&getgrent); -#if !defined(__APPLE__) && !(defined(__sun__) && defined(__svr4__)) +# if !defined(__APPLE__) && !(defined(__sun__) && defined(__svr4__)) && \ + !defined(_AIX) setpwent(); test_r(&getpwent_r); setgrent(); diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/huge_malloc.c b/compiler-rt/test/sanitizer_common/TestCases/Posix/huge_malloc.c index 16ebeda5315e0..883ea6261bb41 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/huge_malloc.c +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/huge_malloc.c @@ -15,6 +15,9 @@ // FIXME: Something wrong with MADV_FREE or MAP_NORESERVE there. // UNSUPPORTED: target={{.*solaris.*}} +// Large calloc causes AIX kill all bash processes. +// UNSUPPORTED: target={{.*aix.*}} + void *p; int main(int argc, char **argv) { diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/illegal_read_test.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/illegal_read_test.cpp index 45d3f256378fc..3c770064b2646 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/illegal_read_test.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/illegal_read_test.cpp @@ -4,7 +4,7 @@ // RUN: %clangxx -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s // REQUIRES: stable-runtime -// XFAIL: target={{(powerpc64|s390x).*}} +// XFAIL: target={{(powerpc|powerpc64|s390x).*}} volatile int *null = 0; volatile int a; diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/illegal_write_test.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/illegal_write_test.cpp index 9b94b8d0237ce..5995f0760601b 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/illegal_write_test.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/illegal_write_test.cpp @@ -4,7 +4,7 @@ // RUN: %clangxx -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s // REQUIRES: stable-runtime -// XFAIL: target={{(powerpc64|s390x).*}} +// XFAIL: target={{(powerpc|powerpc64|s390x).*}} volatile int *null = 0; diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/posix_spawn.c b/compiler-rt/test/sanitizer_common/TestCases/Posix/posix_spawn.c index ea58b92af6097..838dc89a86b88 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/posix_spawn.c +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/posix_spawn.c @@ -3,6 +3,9 @@ // Older versions of Android do not have certain posix_spawn* functions. // UNSUPPORTED: android +// AIX reports EINVAL for the posix_spawnp() even without asan. +// UNSUPPORTED: target={{.*aix.*}} + #include #include #include diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/setvbuf.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/setvbuf.cpp index b7bcdf15499d2..20db3166032a1 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/setvbuf.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/setvbuf.cpp @@ -2,6 +2,9 @@ // UNSUPPORTED: target={{.*solaris.*}} +// AIX can get "setvbuf" printed but after `FileCheck` can not find it after "2>&1 |" +// UNSUPPORTED: target={{.*aix.*}} + #include void print_something() { diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/signal.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/signal.cpp index e96717f3b267c..26f5f366e06dc 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/signal.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/signal.cpp @@ -1,5 +1,8 @@ // RUN: %clangxx -std=c++11 -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s +// line 73 signal(SIGRTMAX + 1, &signal_handler) will not fail on AIX, SIGRTMAX + 1 is a valid signal. +// UNSUPPORTED: target={{.*aix.*}} + #include #include #include diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/sl_add.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/sl_add.cpp index 6c14add8c4078..dc6e04bb81986 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/sl_add.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/sl_add.cpp @@ -1,6 +1,7 @@ // RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s // -// UNSUPPORTED: darwin, target={{.*(linux|solaris).*}} +// AIX does not have stringlist.h. +// UNSUPPORTED: darwin, target={{.*(linux|solaris|aix).*}} #include #include diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/strlcat.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/strlcat.cpp index b026f12f35fca..4ed823bc4c053 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/strlcat.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/strlcat.cpp @@ -1,6 +1,7 @@ // RUN: %clangxx -O0 -g %s -o %t && %run %t -// UNSUPPORTED: target={{.*linux.*}} +// AIX does not define strlcat. +// UNSUPPORTED: target={{.*(linux|aix).*}} #include #include diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/strlcpy.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/strlcpy.cpp index d7a5d1d3a51e9..a3ad20d897335 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/strlcpy.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/strlcpy.cpp @@ -1,6 +1,7 @@ // RUN: %clangxx -O0 -g %s -o %t && %run %t -// UNSUPPORTED: target={{.*linux.*}} +// AIX does not define strlcpy. +// UNSUPPORTED: target={{.*(linux|aix).*}} #include #include diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/strtonum.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/strtonum.cpp index a4f013096c596..0052d8103f464 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/strtonum.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/strtonum.cpp @@ -1,6 +1,7 @@ // RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s // -// UNSUPPORTED: darwin, target={{.*(linux|solaris).*}} +// AIX does not define strtonum +// UNSUPPORTED: darwin, target={{.*(linux|solaris|aix).*}} #define _OPENBSD_SOURCE diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/sysctl.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/sysctl.cpp index 38c34259bbae0..0f4e94dd9f562 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/sysctl.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/sysctl.cpp @@ -1,6 +1,7 @@ // RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s // -// UNSUPPORTED: linux, target={{.*solaris.*}} +// AIX does not have sys/sysctl.h +// UNSUPPORTED: linux, target={{.*(solaris|aix).*}} #include #include diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/vis.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/vis.cpp index 0d31082f92b25..96b9e4270fcbf 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/vis.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/vis.cpp @@ -1,6 +1,7 @@ // RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s // -// UNSUPPORTED: target={{.*(linux|solaris).*}}, darwin +// AIX does not have err.h +// UNSUPPORTED: target={{.*(linux|solaris|aix).*}}, darwin #include #include diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/wcsdup.c b/compiler-rt/test/sanitizer_common/TestCases/Posix/wcsdup.c index e26aad855621c..36b7a574775a1 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/wcsdup.c +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/wcsdup.c @@ -1,5 +1,12 @@ // RUN: %clang %s -o %t && %run %t 2>&1 +// wcsdup internally calls malloc defined in libc library, however +// aix sanitizers can not intercept functions used in shared libraries, +// so the malloc is not intercepted and this case get error for the free: +// AddressSanitizer: attempting free on address which was not malloc()-ed: +// +// UNSUPPORTED: target={{.*aix.*}} + #include #include #include diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/weak_hook_test.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/weak_hook_test.cpp index e95de739fe784..21fd18090c7dd 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/weak_hook_test.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/weak_hook_test.cpp @@ -7,6 +7,9 @@ // FIXME: Implement. // XFAIL: hwasan +// AIX does not define strcasestr. +// UNSUPPORTED: target={{.*aix.*}} + #include #include #if defined(_GNU_SOURCE) diff --git a/compiler-rt/test/sanitizer_common/TestCases/allocator_returns_null.cpp b/compiler-rt/test/sanitizer_common/TestCases/allocator_returns_null.cpp index ca6f637b9a3f5..0be4099e2a2c0 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/allocator_returns_null.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/allocator_returns_null.cpp @@ -38,6 +38,9 @@ // TODO(alekseyshl): win32 is disabled due to failing errno tests, fix it there. // UNSUPPORTED: ubsan, target={{.*windows-msvc.*}} +// The llvm-symbolizer on AIX can not symbolize the pc to asan's source. +// XFAIL: target={{.*aix.*}} + #include #include #include diff --git a/compiler-rt/test/sanitizer_common/TestCases/get_module_and_offset_for_pc.cpp b/compiler-rt/test/sanitizer_common/TestCases/get_module_and_offset_for_pc.cpp index 662625e16f3e1..f3bbb736c420a 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/get_module_and_offset_for_pc.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/get_module_and_offset_for_pc.cpp @@ -6,6 +6,10 @@ // UNSUPPORTED: i386-darwin // XFAIL: android +// Asan on AIX passes /proc//object/ to the symbolizer at runtime, instead of the +// real path to the module. +// UNSUPPORTED: target={{.*}}-aix{{.*}} + // Tests __sanitizer_get_module_and_offset_for_pc. #include diff --git a/compiler-rt/test/sanitizer_common/TestCases/hard_rss_limit_mb_test.cpp b/compiler-rt/test/sanitizer_common/TestCases/hard_rss_limit_mb_test.cpp index 4eb2247b1d38f..343c1edbfb181 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/hard_rss_limit_mb_test.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/hard_rss_limit_mb_test.cpp @@ -17,6 +17,9 @@ // THUMB starts background thead only for Asan. // XFAIL: target=thumb{{.*}} && !asan +// AIX does not use background thread. +// UNSUPPORTED: target={{.*aix.*}} + #include #include #include diff --git a/compiler-rt/test/sanitizer_common/TestCases/max_allocation_size.cpp b/compiler-rt/test/sanitizer_common/TestCases/max_allocation_size.cpp index 2fde16fbed3d2..eb7ad6c68e644 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/max_allocation_size.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/max_allocation_size.cpp @@ -46,6 +46,9 @@ // Symbolizer needs to allocated memory when reporting. // UNSUPPORTED: internal_symbolizer +// The llvm-symbolizer on AIX can not symbolize the pc to asan's source. +// XFAIL: target={{.*aix.*}} + #include #include #include diff --git a/compiler-rt/test/sanitizer_common/TestCases/print-stack-trace.cpp b/compiler-rt/test/sanitizer_common/TestCases/print-stack-trace.cpp index 9d7d03d81b531..4bff52968cf17 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/print-stack-trace.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/print-stack-trace.cpp @@ -19,15 +19,15 @@ int main() { FooBarBaz(); return 0; } -// CHECK: {{ #0 0x.* in __sanitizer_print_stack_trace}} -// CHECK: {{ #1 0x.* in FooBarBaz(\(\))? .*}}print-stack-trace.cpp:[[@LINE-8]] -// CHECK: {{ #2 0x.* in main.*}}print-stack-trace.cpp:[[@LINE-5]] +// CHECK: {{ #0 0x.* in \.?__sanitizer_print_stack_trace}} +// CHECK: {{ #1 0x.* in \.?FooBarBaz(\(\))? .*}}print-stack-trace.cpp:[[@LINE-8]] +// CHECK: {{ #2 0x.* in \.?main.*}}print-stack-trace.cpp:[[@LINE-5]] // CUSTOM: frame1_lineno[[@LINE-11]] // CUSTOM: frame2_lineno[[@LINE-8]] -// NOINLINE: #0 0x{{.*}} in __sanitizer_print_stack_trace -// NOINLINE: #1 0x{{.*}} in main{{.*}}print-stack-trace.cpp:[[@LINE-15]] +// NOINLINE: #0 0x{{.*}} in {{\.?__sanitizer_print_stack_trace}} +// NOINLINE: #1 0x{{.*}} in {{\.?main}}{{.*}}print-stack-trace.cpp:[[@LINE-15]] // NOSYMBOLIZE: frame:0 address:{{0x.*}} // NOSYMBOLIZE: frame:1 address:{{0x.*}} diff --git a/compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_allowlist_ignorelist.cpp b/compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_allowlist_ignorelist.cpp index 6fdd23b84432f..72590ad3d6343 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_allowlist_ignorelist.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_allowlist_ignorelist.cpp @@ -7,6 +7,9 @@ // XFAIL: ubsan,tsan // XFAIL: android && asan +// FIXME: support -fsanitize-coverage on AIX +// UNSUPPORTED: target={{.*aix.*}} + // RUN: rm -rf %t_workdir // RUN: mkdir -p %t_workdir // RUN: cd %t_workdir diff --git a/compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_control_flow.cpp b/compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_control_flow.cpp index 5223af07f18ae..7cda2275cfbd7 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_control_flow.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_control_flow.cpp @@ -6,6 +6,8 @@ // RUN: %clangxx -O0 -std=c++11 -fsanitize-coverage=control-flow %s -o %t // RUN: %run %t 2>&1 | FileCheck %s +// XFAIL: target={{.*aix.*}} + #include #include #if __has_feature(ptrauth_calls) diff --git a/compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_inline8bit_counter.cpp b/compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_inline8bit_counter.cpp index 68eca85eb4d42..4579a8a8ee646 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_inline8bit_counter.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_inline8bit_counter.cpp @@ -6,6 +6,8 @@ // RUN: %clangxx -O0 %s -fsanitize-coverage=inline-8bit-counters,pc-table -o %t // RUN: %run %t 2>&1 | FileCheck %s +// XFAIL: target={{.*aix.*}} + #include #include #include diff --git a/compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_inline_bool_flag.cpp b/compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_inline_bool_flag.cpp index d62ffe613b5b0..94b4cd3e93094 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_inline_bool_flag.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_inline_bool_flag.cpp @@ -6,6 +6,8 @@ // RUN: %clangxx -O0 %s -fsanitize-coverage=inline-bool-flag,pc-table -o %t // RUN: %run %t 2>&1 | FileCheck %s +// XFAIL: target={{.*aix.*}} + #include #include #include diff --git a/compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_stack_depth.cpp b/compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_stack_depth.cpp index 29a63c0a92f32..889125421db6b 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_stack_depth.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_stack_depth.cpp @@ -6,6 +6,8 @@ // RUN: %s -o %t // RUN: %run %t 2>&1 | FileCheck %s --implicit-check-not Assertion{{.*}}failed +// UNSUPPORTED: target={{.*aix.*}} + #include #include #include diff --git a/compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_trace_pc_guard-dso.cpp b/compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_trace_pc_guard-dso.cpp index f6ccbb6981352..8986dc1adca4c 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_trace_pc_guard-dso.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_trace_pc_guard-dso.cpp @@ -6,6 +6,9 @@ // XFAIL: tsan,darwin // XFAIL: android && asan +// FIXME: support -fsanitize-coverage on AIX +// UNSUPPORTED: target={{.*aix.*}} + // RUN: rm -rf %t_workdir // RUN: mkdir -p %t_workdir // RUN: cd %t_workdir diff --git a/compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_trace_pc_guard.cpp b/compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_trace_pc_guard.cpp index 84c28e82f04ac..94508a939340a 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_trace_pc_guard.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_trace_pc_guard.cpp @@ -7,6 +7,9 @@ // XFAIL: tsan // XFAIL: android && asan +// FIXME: support -fsanitize-coverage on AIX +// UNSUPPORTED: target={{.*aix.*}} + // RUN: rm -rf %t_workdir // RUN: mkdir -p %t_workdir // RUN: cd %t_workdir diff --git a/compiler-rt/test/sanitizer_common/TestCases/strcasestr.c b/compiler-rt/test/sanitizer_common/TestCases/strcasestr.c index 8831977569b84..f3280a87dde93 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/strcasestr.c +++ b/compiler-rt/test/sanitizer_common/TestCases/strcasestr.c @@ -3,6 +3,9 @@ // There's no interceptor for strcasestr on Windows // XFAIL: target={{.*windows-msvc.*}} +// AIX does not define strcasestr +// UNSUPPORTED: target={{.*aix.*}} + #define _GNU_SOURCE #include #include diff --git a/compiler-rt/test/sanitizer_common/TestCases/suffix-log-path_test.c b/compiler-rt/test/sanitizer_common/TestCases/suffix-log-path_test.c index 8e131054c2d4d..2ebc700317dd2 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/suffix-log-path_test.c +++ b/compiler-rt/test/sanitizer_common/TestCases/suffix-log-path_test.c @@ -19,4 +19,4 @@ int main(int argc, char **argv) { __sanitizer_print_stack_trace(); return 0; } -// CHECK: #{{.*}} main +// CHECK: #{{.*}} {{\.?main}} diff --git a/compiler-rt/test/sanitizer_common/TestCases/symbolize_pc.cpp b/compiler-rt/test/sanitizer_common/TestCases/symbolize_pc.cpp index f495e2cefdd74..7617796e05988 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/symbolize_pc.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/symbolize_pc.cpp @@ -3,6 +3,9 @@ // // Tests __sanitizer_symbolize_pc. +// FIXME: llvm-symbolizer on AIX can't resolve line number for the global +// XFAIL: target={{.*-aix.*}} + // FIXME: Investigate why it does not print GLOBAL_VAR_ABC. // XFAIL: hwasan && target=aarch64{{.*}} // LSan tests fail on Darwin @@ -72,12 +75,12 @@ int main() { // CHECK: PARTIAL '0x{{.*}}' SymbolizeSmallBuffer(); - // CHECK: FIRST_FORMAT 0x{{.*}} in main symbolize_pc.cpp:[[@LINE+2]] - // CHECK: SECOND_FORMAT FUNC:main LINE:[[@LINE+1]] FILE:symbolize_pc.cpp + // CHECK: FIRST_FORMAT 0x{{.*}} in {{\.?main}} symbolize_pc.cpp:[[@LINE+2]] + // CHECK: SECOND_FORMAT FUNC:{{\.?main}} LINE:[[@LINE+1]] FILE:symbolize_pc.cpp SymbolizeCaller(); struct s s; - // CHECK: SRET: FUNC:main LINE:[[@LINE+1]] FILE:symbolize_pc.cpp + // CHECK: SRET: FUNC:{{\.?main}} LINE:[[@LINE+1]] FILE:symbolize_pc.cpp s = SymbolizeSRet(); // CHECK: GLOBAL: GLOBAL_VAR_ABC diff --git a/compiler-rt/test/sanitizer_common/TestCases/symbolize_pc_demangle.cpp b/compiler-rt/test/sanitizer_common/TestCases/symbolize_pc_demangle.cpp index 6e035c16a3045..c06f8040543b9 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/symbolize_pc_demangle.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/symbolize_pc_demangle.cpp @@ -22,8 +22,8 @@ struct Symbolizer { __attribute__((noinline)) ~Symbolizer() { Symbolize(); } }; -// NODEMANGLE: in _ZN10SymbolizerD2Ev -// CHECK: in Symbolizer::~Symbolizer +// NODEMANGLE: in {{\.?_ZN10SymbolizerD2Ev}} +// CHECK: in {{\.?Symbolizer::~Symbolizer}} int main() { Symbolizer(); return 0; diff --git a/compiler-rt/test/sanitizer_common/TestCases/symbolize_pc_inline.cpp b/compiler-rt/test/sanitizer_common/TestCases/symbolize_pc_inline.cpp index e95ef324db652..90196726751a9 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/symbolize_pc_inline.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/symbolize_pc_inline.cpp @@ -18,7 +18,7 @@ __attribute__((noinline)) static void Symbolize() { printf("%s\n", p); } -// NOINLINE: {{0x[0-9a-f]+}} in main symbolize_pc_inline.cpp:[[@LINE+2]] +// NOINLINE: {{0x[0-9a-f]+}} in {{\.?main}} symbolize_pc_inline.cpp:[[@LINE+2]] // CHECK: [[ADDR:0x[0-9a-f]+]] in C2 symbolize_pc_inline.cpp:[[@LINE+1]] static inline void C2() { Symbolize(); } @@ -28,5 +28,5 @@ static inline void C3() { C2(); } // CHECK: [[ADDR]] in C4 symbolize_pc_inline.cpp:[[@LINE+1]] static inline void C4() { C3(); } -// CHECK: [[ADDR]] in main symbolize_pc_inline.cpp:[[@LINE+1]] +// CHECK: [[ADDR]] in {{\.?main}} symbolize_pc_inline.cpp:[[@LINE+1]] int main() { C4(); } diff --git a/compiler-rt/test/sanitizer_common/lit.common.cfg.py b/compiler-rt/test/sanitizer_common/lit.common.cfg.py index c3c1336bacd53..cc001a58ed77d 100644 --- a/compiler-rt/test/sanitizer_common/lit.common.cfg.py +++ b/compiler-rt/test/sanitizer_common/lit.common.cfg.py @@ -92,7 +92,7 @@ def build_invocation(compile_flags): config.suffixes = [".c", ".cpp"] -if config.host_os not in ["Linux", "Darwin", "NetBSD", "FreeBSD", "SunOS"]: +if config.host_os not in ["Linux", "Darwin", "NetBSD", "FreeBSD", "SunOS", "AIX"]: config.unsupported = True if not config.parallelism_group: