[compiler-rt] [asan] Enable build and testing of asan on AIX (PR #137186)
Jake Egan via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 29 11:44:52 PDT 2025
https://github.com/jakeegan updated https://github.com/llvm/llvm-project/pull/137186
>From 5d744441eff60eb729fe75507e4f6b26b3fcbcbc Mon Sep 17 00:00:00 2001
From: Jake Egan <jake.egan at ibm.com>
Date: Thu, 24 Apr 2025 10:36:40 -0400
Subject: [PATCH 1/9] Enable build and testing of asan on AIX
---
compiler-rt/cmake/Modules/AddCompilerRT.cmake | 17 +++++++++
.../cmake/Modules/AllSupportedArchDefs.cmake | 4 +-
compiler-rt/cmake/base-config-ix.cmake | 6 ++-
compiler-rt/cmake/config-ix.cmake | 3 +-
compiler-rt/test/asan/CMakeLists.txt | 2 +-
.../Posix/asan-symbolize-bad-path.cpp | 4 ++
.../Posix/asan-symbolize-sanity-test.cpp | 8 ++--
.../plugin_wrong_frame_number_bug.cpp | 4 +-
.../test/asan/TestCases/Posix/asprintf.cpp | 3 ++
.../test/asan/TestCases/Posix/closed-fds.cpp | 2 +-
.../asan/TestCases/Posix/coverage-fork.cpp | 2 +
.../Posix/coverage-module-unloaded.cpp | 3 ++
.../asan/TestCases/Posix/coverage-reset.cpp | 2 +
.../test/asan/TestCases/Posix/coverage.cpp | 3 ++
.../asan/TestCases/Posix/deep_call_stack.cpp | 3 +-
.../asan/TestCases/Posix/fake_stack_gc.cpp | 3 ++
.../test/asan/TestCases/Posix/fgets_fputs.cpp | 6 +--
.../asan/TestCases/Posix/fread_fwrite.cpp | 4 +-
.../Posix/interception-in-shared-lib-test.cpp | 2 +-
.../Posix/invalid-pointer-pairs-threads.cpp | 14 ++++++-
.../test/asan/TestCases/Posix/ioctl.cpp | 2 +-
.../TestCases/Posix/new_array_cookie_test.cpp | 2 +-
.../TestCases/Posix/no_asan_gen_globals.c | 5 ++-
.../asan/TestCases/Posix/shared-lib-test.cpp | 4 +-
.../asan/TestCases/Posix/stack-overflow.cpp | 2 +
.../TestCases/Posix/start-deactivated.cpp | 26 +++++++------
.../Posix/unpoison-alternate-stack.cpp | 3 ++
.../test/asan/TestCases/Posix/wait.cpp | 4 +-
.../test/asan/TestCases/Posix/wait3.cpp | 4 +-
.../test/asan/TestCases/Posix/wait4.cpp | 4 +-
.../test/asan/TestCases/Posix/waitid.cpp | 4 +-
.../test/asan/TestCases/calloc-overflow.cpp | 2 +-
.../test/asan/TestCases/coverage-disabled.cpp | 3 ++
.../test/asan/TestCases/debug_double_free.cpp | 2 +-
.../test/asan/TestCases/debug_locate.cpp | 4 ++
.../asan/TestCases/debug_ppc64_mapping.cpp | 2 +-
.../test/asan/TestCases/debug_report.cpp | 2 +-
.../test/asan/TestCases/double-free.cpp | 4 +-
.../test/asan/TestCases/frexp_interceptor.cpp | 3 ++
.../asan/TestCases/frexpf_interceptor.cpp | 3 ++
.../asan/TestCases/frexpl_interceptor.cpp | 4 ++
.../TestCases/global-location-nodebug.cpp | 4 +-
.../test/asan/TestCases/global-overflow.cpp | 2 +-
.../test/asan/TestCases/global-underflow.cpp | 5 +++
.../test/asan/TestCases/heap-overflow.cpp | 2 +-
.../test/asan/TestCases/heavy_uar_test.cpp | 2 +-
.../asan/TestCases/initialization-bug.cpp | 2 +-
.../TestCases/intercept-rethrow-exception.cpp | 4 ++
.../test/asan/TestCases/invalid-free.cpp | 9 +++--
.../invalid-pointer-pairs-compare-errors.cpp | 36 +++++++++---------
.../invalid-pointer-pairs-subtract-errors.cpp | 12 +++---
.../asan/TestCases/invalid-pointer-pairs.cpp | 6 +--
.../test/asan/TestCases/large_func_test.cpp | 8 +++-
.../asan/TestCases/malloc-size-too-big.cpp | 2 +-
.../asan/TestCases/malloc_context_size.cpp | 8 ++--
.../test/asan/TestCases/memset_test.cpp | 38 ++++++++++---------
.../test/asan/TestCases/null_deref.cpp | 2 +-
.../test/asan/TestCases/print_summary.cpp | 2 +-
.../replaceable_new_delete_shared.cpp | 3 +-
.../test/asan/TestCases/set_shadow_test.c | 4 ++
.../asan/TestCases/stack-buffer-overflow.cpp | 2 +-
.../test/asan/TestCases/strcasestr-1.c | 3 ++
.../test/asan/TestCases/strcasestr-2.c | 3 ++
.../test/asan/TestCases/strcasestr_strict.c | 3 ++
.../test/asan/TestCases/strcat_strict.c | 3 ++
compiler-rt/test/asan/TestCases/strcmp.c | 3 ++
.../test/asan/TestCases/strcmp_strict.c | 3 ++
.../test/asan/TestCases/strcpy-overlap.cpp | 3 ++
.../test/asan/TestCases/strip_path_prefix.c | 2 +-
.../test/asan/TestCases/strncat-overlap.cpp | 3 ++
.../test/asan/TestCases/strncat_strict.c | 3 ++
.../test/asan/TestCases/strncmp_strict.c | 3 ++
.../test/asan/TestCases/strncpy-overflow.cpp | 3 ++
.../test/asan/TestCases/strncpy-overlap.cpp | 3 ++
.../asan/TestCases/suppressions-library.cpp | 6 +++
.../test/asan/TestCases/use-after-delete.cpp | 12 ++++--
.../asan/TestCases/use-after-free-right.cpp | 6 +--
.../test/asan/TestCases/use-after-free.cpp | 6 +--
.../TestCases/use-after-scope-dtor-order.cpp | 2 +-
.../asan/TestCases/use-after-scope-if.cpp | 2 +-
.../TestCases/use-after-scope-inlined.cpp | 4 +-
.../TestCases/use-after-scope-loop-bug.cpp | 2 +-
.../use-after-scope-loop-removed.cpp | 2 +-
.../asan/TestCases/use-after-scope-loop.cpp | 2 +-
.../asan/TestCases/use-after-scope-temp.cpp | 2 +-
.../asan/TestCases/use-after-scope-temp2.cpp | 2 +-
.../asan/TestCases/use-after-scope-types.cpp | 2 +-
.../test/asan/TestCases/use-after-scope.cpp | 2 +-
.../test/asan/TestCases/zero_page_pc.cpp | 3 ++
compiler-rt/test/asan/lit.cfg.py | 2 +-
compiler-rt/test/lit.common.cfg.py | 30 ++++++++++++---
.../TestCases/Posix/arc4random.cpp | 3 +-
.../TestCases/Posix/create_thread_fail.cpp | 3 ++
.../Posix/dedup_token_length_test.cpp | 6 +--
.../TestCases/Posix/devname.cpp | 3 +-
.../TestCases/Posix/devname_r.cpp | 3 +-
.../TestCases/Posix/fgetln.cpp | 2 +-
.../TestCases/Posix/fseek.cpp | 3 +-
.../sanitizer_common/TestCases/Posix/fts.cpp | 3 +-
.../TestCases/Posix/funopen.cpp | 3 +-
.../TestCases/Posix/getcpuclockid.c | 3 +-
.../TestCases/Posix/getfsent.cpp | 3 +-
.../TestCases/Posix/getmntinfo.cpp | 3 +-
.../TestCases/Posix/getpass.cpp | 3 +-
.../TestCases/Posix/getpw_getgr.cpp | 2 +-
.../TestCases/Posix/huge_malloc.c | 3 ++
.../TestCases/Posix/illegal_read_test.cpp | 2 +-
.../TestCases/Posix/illegal_write_test.cpp | 2 +-
.../TestCases/Posix/posix_spawn.c | 3 ++
.../TestCases/Posix/setvbuf.cpp | 3 ++
.../TestCases/Posix/signal.cpp | 3 ++
.../TestCases/Posix/sl_add.cpp | 3 +-
.../TestCases/Posix/strlcat.cpp | 3 +-
.../TestCases/Posix/strlcpy.cpp | 3 +-
.../TestCases/Posix/strtonum.cpp | 3 +-
.../TestCases/Posix/sysctl.cpp | 3 +-
.../sanitizer_common/TestCases/Posix/vis.cpp | 3 +-
.../sanitizer_common/TestCases/Posix/wcsdup.c | 7 ++++
.../TestCases/Posix/weak_hook_test.cpp | 3 ++
.../TestCases/allocator_returns_null.cpp | 3 ++
.../TestCases/hard_rss_limit_mb_test.cpp | 3 ++
.../TestCases/max_allocation_size.cpp | 3 ++
.../TestCases/print-stack-trace.cpp | 10 ++---
...anitizer_coverage_allowlist_ignorelist.cpp | 3 ++
.../sanitizer_coverage_control_flow.cpp | 2 +
.../sanitizer_coverage_inline8bit_counter.cpp | 2 +
.../sanitizer_coverage_inline_bool_flag.cpp | 2 +
.../sanitizer_coverage_stack_depth.cpp | 2 +
.../sanitizer_coverage_trace_pc_guard-dso.cpp | 3 ++
.../sanitizer_coverage_trace_pc_guard.cpp | 3 ++
.../sanitizer_common/TestCases/strcasestr.c | 3 ++
.../TestCases/suffix-log-path_test.c | 2 +-
.../TestCases/symbolize_pc.cpp | 6 +--
.../TestCases/symbolize_pc_demangle.cpp | 4 +-
.../TestCases/symbolize_pc_inline.cpp | 4 +-
135 files changed, 425 insertions(+), 179 deletions(-)
diff --git a/compiler-rt/cmake/Modules/AddCompilerRT.cmake b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
index d346b0ec01b03..d29ee07ccbdfe 100644
--- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake
+++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
@@ -582,6 +582,23 @@ macro(add_compiler_rt_script name)
DESTINATION ${COMPILER_RT_INSTALL_BINARY_DIR})
endmacro(add_compiler_rt_script src name)
+macro(add_compiler_rt_cfg target_name file_name component)
+ set(src_file "${CMAKE_CURRENT_SOURCE_DIR}/${file_name}")
+ get_compiler_rt_output_dir(${COMPILER_RT_DEFAULT_TARGET_ARCH} output_dir)
+ set(dst_file "${output_dir}/${file_name}")
+ add_custom_command(OUTPUT ${dst_file}
+ DEPENDS ${src_file}
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src_file} ${dst_file}
+ COMMENT "Copying ${file_name}...")
+ add_custom_target(${target_name} DEPENDS ${dst_file})
+ install(FILES ${file_name}
+ DESTINATION ${COMPILER_RT_INSTALL_LIBRARY_DIR}
+ COMPONENT ${component})
+ add_dependencies(${component} ${target_name})
+
+ set_target_properties(${target_name} PROPERTIES FOLDER "Compiler-RT Misc")
+endmacro()
+
# Builds custom version of libc++ and installs it in <prefix>.
# Can be used to build sanitized versions of libc++ for running unit tests.
# add_custom_libcxx(<name> <prefix>
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/base-config-ix.cmake b/compiler-rt/cmake/base-config-ix.cmake
index d92bc0e71fa1a..953fa3983ecfc 100644
--- a/compiler-rt/cmake/base-config-ix.cmake
+++ b/compiler-rt/cmake/base-config-ix.cmake
@@ -14,7 +14,11 @@ include(CompilerRTDarwinUtils)
check_include_file(unwind.h HAVE_UNWIND_H)
# Used by sanitizer_common and tests.
-check_include_file(rpc/xdr.h HAVE_RPC_XDR_H)
+if (${CMAKE_SYSTEM_NAME} MATCHES AIX)
+ check_include_file(tirpc/rpc/xdr.h HAVE_RPC_XDR_H)
+else()
+ check_include_file(rpc/xdr.h HAVE_RPC_XDR_H)
+endif()
if (NOT HAVE_RPC_XDR_H)
set(HAVE_RPC_XDR_H 0)
endif()
diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake
index cf729c3adb1f5..075493feeadbd 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" OR
+ (OS_NAME MATCHES "Android|Darwin|Linux|FreeBSD|NetBSD|Fuchsia|SunOS|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/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..07a3b268846b3 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
@@ -38,11 +38,11 @@ int main(int argc, char *argv[]) {
inc2(array, -1); // BOOM
// CHECK: ERROR: AddressSanitizer: heap-buffer-overflow
// CHECK: READ of size 4 at 0x{{.*}}
- // CHECK: #0 {{.*}} in inc2 {{.*}}asan-symbolize-sanity-test.cpp:[[@LINE+21]]
- // CHECK: #1 {{.*}} in main {{.*}}asan-symbolize-sanity-test.cpp:[[@LINE-4]]
+ // CHECK: #0 {{.*}} in {{inc2|.inc2}} {{.*}}asan-symbolize-sanity-test.cpp:[[@LINE+21]]
+ // CHECK: #1 {{.*}} in {{main|.main}} {{.*}}asan-symbolize-sanity-test.cpp:[[@LINE-4]]
// CHECK: allocated by thread T{{.*}} here:
- // CHECK: #{{.*}} in {{(wrap_|_?__interceptor_)?}}malloc
- // CHECK: #{{.*}} in main {{.*}}asan-symbolize-sanity-test.cpp:[[@LINE-9]]
+ // CHECK: #{{.*}} in {{(wrap_|_?__interceptor_)?}}{{malloc|.vec_malloc}}
+ // CHECK: #{{.*}} in {{main|.main}} {{.*}}asan-symbolize-sanity-test.cpp:[[@LINE-9]]
return 0;
}
#else // SHARED_LIBS
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..a41477f92dc4a 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
@@ -46,5 +46,5 @@ int main(int argc, char** argv) {
// CHECK: AddressSanitizer: heap-use-after-free
// CHECK-NEXT: WRITE of size
// CHECK-NEXT: #0 0x{{[0-9a-fA-F]+}}
-// CHECK-NEXT: #1 0x{{[0-9a-fA-F]+}} in do_access
-// CHECK-NEXT: #2 0x{{[0-9a-fA-F]+}} in main
+// CHECK-NEXT: #1 0x{{[0-9a-fA-F]+}} in {{do_access|.do_access}}
+// CHECK-NEXT: #2 0x{{[0-9a-fA-F]+}} in {{main|.main}}
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..230ca078ec093 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|.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 <assert.h>
#include <dlfcn.h>
#include <stdint.h>
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 <stdio.h>
#include <sanitizer/coverage_interface.h>
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 <assert.h>
#include <stdio.h>
#include <string.h>
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 <algorithm>
#include <assert.h>
#include <csignal>
diff --git a/compiler-rt/test/asan/TestCases/Posix/fgets_fputs.cpp b/compiler-rt/test/asan/TestCases/Posix/fgets_fputs.cpp
index 34c952f2e02ef..30c06fee171ba 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|.fgets}}
// CHECK-FPUTS: {{.*ERROR: AddressSanitizer: stack-buffer-overflow}}
-// CHECK-FPUTS: #{{.*}} in {{(wrap_|__interceptor_)?}}fputs
+// CHECK-FPUTS: #{{.*}} in {{(wrap_|__interceptor_)?}}{{fputs|.fputs}}
// CHECK-PUTS: {{.*ERROR: AddressSanitizer: heap-use-after-free}}
-// CHECK-PUTS: #{{.*}} in {{(wrap_|__interceptor_)?}}puts
+// CHECK-PUTS: #{{.*}} in {{(wrap_|__interceptor_)?}}{{puts|.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..f6cc8dc60c3f7 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|.fread}}
// CHECK-FWRITE: {{.*ERROR: AddressSanitizer: stack-buffer-overflow}}
-// CHECK-FWRITE: #{{.*}} in {{(wrap_|__interceptor_)?}}fwrite
+// CHECK-FWRITE: #{{.*}} in {{(wrap_|__interceptor_)?}}{{fwrite|.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..67010cd6948f4 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
@@ -21,7 +21,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|.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..3498c7c2a14fd 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|.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..d10e711214829 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|.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..614569b00f28a 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
@@ -20,7 +20,7 @@ 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: in {{main|.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..136f150c94c7f 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
@@ -3,7 +3,10 @@
// Make sure ___asan_gen_* strings do not end up in the symbol table.
// RUN: %clang_asan %s -o %t.exe
-// RUN: nm %t.exe | FileCheck %s
+// RUN: nm %if target={{.*aix.*}} %{ -X32_64 %} %t.exe | FileCheck %s
+
+// UNSUPPORTED: target={{.*aix.*}}
+
int x, y, z;
int main() { return 0; }
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..b68d20bbb0a02 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|.main) .*shared-lib-test.cpp:}}[[@LINE-4]]
return 0;
}
#else // SHARED_LIB
diff --git a/compiler-rt/test/asan/TestCases/Posix/stack-overflow.cpp b/compiler-rt/test/asan/TestCases/Posix/stack-overflow.cpp
index b109a3a23ea5b..85c0cfb41bc5e 100644
--- a/compiler-rt/test/asan/TestCases/Posix/stack-overflow.cpp
+++ b/compiler-rt/test/asan/TestCases/Posix/stack-overflow.cpp
@@ -21,6 +21,8 @@
// UNSUPPORTED: ios
+// XFAIL: target={{powerpc-.*aix.*}}
+
#include <assert.h>
#include <stdlib.h>
#include <pthread.h>
diff --git a/compiler-rt/test/asan/TestCases/Posix/start-deactivated.cpp b/compiler-rt/test/asan/TestCases/Posix/start-deactivated.cpp
index 4ddfd423167d3..f9bdb5cc85178 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
@@ -83,27 +87,27 @@ int main(int argc, char *argv[]) {
// After this line ASan is activated and starts detecting errors.
void *fn = dlsym(dso, "do_another_bad_thing");
if (!fn) {
- fprintf(stderr, "dlsym failed: %s\n", dlerror());
- return 1;
+ fprintf(stderr, "dlsym failed: %s\n", dlerror());
+ return 1;
}
// After activation: redzones.
for (int i = 1; i < HoneyPotSize; ++i) {
- honeyPot[i] = (char *)malloc(HoneyPotBlockSize);
- test_malloc_shadow(honeyPot[i], HoneyPotBlockSize, true);
+ honeyPot[i] = (char *)malloc(HoneyPotBlockSize);
+ test_malloc_shadow(honeyPot[i], HoneyPotBlockSize, true);
}
{
- char *p = (char *)malloc(HoneyPotBlockSize);
- test_malloc_shadow(p, HoneyPotBlockSize, true);
- free(p);
+ char *p = (char *)malloc(HoneyPotBlockSize);
+ test_malloc_shadow(p, HoneyPotBlockSize, true);
+ free(p);
}
for (int i = 1; i < HoneyPotSize; ++i)
- free(honeyPot[i]);
+ free(honeyPot[i]);
// Pre-existing allocations got redzones, too.
for (size_t sz = 1; sz < nPtrs; ++sz) {
- test_malloc_shadow(ptrs[sz], sz, true);
- free(ptrs[sz]);
+ test_malloc_shadow(ptrs[sz], sz, true);
+ free(ptrs[sz]);
}
// Test that ASAN_ACTIVATION_OPTIONS=allocator_may_return_null=1 has effect.
@@ -116,7 +120,7 @@ int main(int argc, char *argv[]) {
// CHECK: READ of size 1
// CHECK: {{#0 .* in do_another_bad_thing}}
// CHECK: is located 5 bytes after 100-byte region
- // CHECK: in do_another_bad_thing
+ // CHECK: in {{do_another_bad_thing|.do_another_bad_thing}}
return 0;
}
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 <algorithm>
#include <cassert>
#include <cerrno>
diff --git a/compiler-rt/test/asan/TestCases/Posix/wait.cpp b/compiler-rt/test/asan/TestCases/Posix/wait.cpp
index 7ca1c57a2edd9..5438249df65bc 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|.main) .*wait.cpp:}}
// CHECK: is located in stack of thread T0 at offset
- // CHECK: {{in main}}
+ // CHECK: {{in (main|.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..77e89921cec4e 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|.main) .*wait3.cpp:}}
// CHECK: is located in stack of thread T0 at offset
- // CHECK: {{in main}}
+ // CHECK: {{in (main|.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..a91c9e88c8959 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|.main) .*wait4.cpp:}}
// CHECK: is located in stack of thread T0 at offset
- // CHECK: {{in main}}
+ // CHECK: {{in (main|.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..0e1a068907dd8 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|.main) .*waitid.cpp:}}
// CHECK: is located in stack of thread T0 at offset
- // CHECK: {{in main}}
+ // CHECK: {{in (main|.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..ceebdd3faa0bf 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|.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..e4afaf0cf1821 100644
--- a/compiler-rt/test/asan/TestCases/debug_double_free.cpp
+++ b/compiler-rt/test/asan/TestCases/debug_double_free.cpp
@@ -13,7 +13,7 @@
# define PTR_FMT "0x%08x"
# endif
// Solaris libc omits the leading 0x.
-#elif defined(__sun__) && defined(__svr4__)
+#elif (defined(__sun__) && defined(__svr4__)) || defined(_AIX)
# define PTR_FMT "0x%p"
#else
# define PTR_FMT "%p"
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 <stdio.h>
diff --git a/compiler-rt/test/asan/TestCases/debug_report.cpp b/compiler-rt/test/asan/TestCases/debug_report.cpp
index 0dbb9f2fb9988..80cd9624523dd 100644
--- a/compiler-rt/test/asan/TestCases/debug_report.cpp
+++ b/compiler-rt/test/asan/TestCases/debug_report.cpp
@@ -28,7 +28,7 @@ int main() {
# define PTR_FMT "0x%08x"
# endif
// Solaris libc omits the leading 0x.
-#elif defined(__sun__) && defined(__svr4__)
+#elif (defined(__sun__) && defined(__svr4__)) || defined(_AIX)
# define PTR_FMT "0x%p"
#else
# define PTR_FMT "%p"
diff --git a/compiler-rt/test/asan/TestCases/double-free.cpp b/compiler-rt/test/asan/TestCases/double-free.cpp
index 7b61df0715afa..9fbeb0ad3cd3b 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|.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|.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/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 <math.h>
#include <stdio.h>
#include <stdlib.h>
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 <math.h>
#include <stdio.h>
#include <stdlib.h>
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 <math.h>
#include <stdio.h>
#include <stdlib.h>
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-overflow.cpp b/compiler-rt/test/asan/TestCases/global-overflow.cpp
index ed276ca44aa26..ffc311b614f7c 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|.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 <string.h>
diff --git a/compiler-rt/test/asan/TestCases/heap-overflow.cpp b/compiler-rt/test/asan/TestCases/heap-overflow.cpp
index f5bdcd5386373..102f5eafcb16e 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|.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..c8cffdc7c4de0 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|.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..9d21a75c8fdc2 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|.__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 <assert.h>
#include <exception>
diff --git a/compiler-rt/test/asan/TestCases/invalid-free.cpp b/compiler-rt/test/asan/TestCases/invalid-free.cpp
index f550dc14a5a68..09228dc8ab69e 100644
--- a/compiler-rt/test/asan/TestCases/invalid-free.cpp
+++ b/compiler-rt/test/asan/TestCases/invalid-free.cpp
@@ -1,9 +1,12 @@
// RUN: %clangxx_asan -O0 %s -o %t
-// RUN: not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=MALLOC-CTX
+// RUN: %if target={{.*aix.*}} %{ %env_asan_opts=enable_unmalloced_free_check=1 %} not %run %t 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=MALLOC-CTX
// Also works if no malloc context is available.
-// RUN: %env_asan_opts=malloc_context_size=0:fast_unwind_on_malloc=0 not %run %t 2>&1 | FileCheck %s
-// RUN: %env_asan_opts=malloc_context_size=0:fast_unwind_on_malloc=1 not %run %t 2>&1 | FileCheck %s
+// RUN: %if target={{.*aix.*}} %{ %env_asan_opts=malloc_context_size=0:fast_unwind_on_malloc=0:enable_unmalloced_free_check=1 %} %else \
+// RUN: %{ %env_asan_opts=malloc_context_size=0:fast_unwind_on_malloc=0 %} not %run %t 2>&1 | FileCheck %s
+// RUN: %if target={{.*aix.*}} %{ %env_asan_opts=malloc_context_size=0:fast_unwind_on_malloc=1:enable_unmalloced_free_check=1 %} %else \
+// RUN: %{ %env_asan_opts=malloc_context_size=0:fast_unwind_on_malloc=1 %} not %run %t 2>&1 | FileCheck %s
// REQUIRES: stable-runtime
#include <stdlib.h>
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..ebebbad07c660 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|.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|.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|.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|.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|.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|.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|.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|.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|.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|.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|.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|.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|.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|.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|.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|.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|.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|.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..0481f6bc8ddd6 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|.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|.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|.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..7b46010d3c08f 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|.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|.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..e3d0d57920242 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|.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..a249df54b8cb5 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|.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 <assert.h>
#include <string.h>
diff --git a/compiler-rt/test/asan/TestCases/null_deref.cpp b/compiler-rt/test/asan/TestCases/null_deref.cpp
index 3ccb475326369..2ee595c8032bb 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|.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..ec407855304b8 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|.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..341003750b674 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|.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 <assert.h>
#include <string.h>
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 <assert.h>
#include <string.h>
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 <assert.h>
#include <stdlib.h>
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 <assert.h>
#include <stdlib.h>
#include <string.h>
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 <assert.h>
#include <stdlib.h>
#include <string.h>
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 <assert.h>
#include <stdlib.h>
#include <string.h>
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 <string.h>
diff --git a/compiler-rt/test/asan/TestCases/strip_path_prefix.c b/compiler-rt/test/asan/TestCases/strip_path_prefix.c
index e77f1d5ddaf42..0534bb1d09167 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|.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 <string.h>
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 <assert.h>
#include <stdlib.h>
#include <string.h>
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 <assert.h>
#include <stdlib.h>
#include <stdio.h>
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 <stdlib.h>
#include <string.h>
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 <string.h>
diff --git a/compiler-rt/test/asan/TestCases/suppressions-library.cpp b/compiler-rt/test/asan/TestCases/suppressions-library.cpp
index 5427122eaa92f..78a1235c83c5b 100644
--- a/compiler-rt/test/asan/TestCases/suppressions-library.cpp
+++ b/compiler-rt/test/asan/TestCases/suppressions-library.cpp
@@ -12,6 +12,12 @@
// 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 <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/compiler-rt/test/asan/TestCases/use-after-delete.cpp b/compiler-rt/test/asan/TestCases/use-after-delete.cpp
index 4d0c055368bb0..ee8146cff99dc 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 <stdlib.h>
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|.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|.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|.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..90e8c61d740e1 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|.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|.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|.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..7d02d97a6678c 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|.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|.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|.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..a10984488fc40 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|.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..d94bc03754078 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|.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..d9f70a51d8f0e 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|.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|.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..41bb23c765428 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|.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..cc15c1da20d56 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|.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..703b1ec251f00 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|.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..348450795bd2f 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|.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..db36f654bfcdb 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|.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..8edc2a9eda722 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 <class T> 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 |.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..746788823e333 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|.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..0233b583992a8 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 <ptrauth.h>
#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..6da4753a64a82 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 = ""
diff --git a/compiler-rt/test/lit.common.cfg.py b/compiler-rt/test/lit.common.cfg.py
index 877718c703ba7..822a9aa0dd4be 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 <cstdlib>
#include <ctime>
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 <cassert>
#include <pthread.h>
#include <stdlib.h>
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..d375a92a4c6a8 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<int, int>()
-// CHECK2: DEDUP_TOKEN: void Xyz::Abc<int, int>()--bar
-// CHECK3: DEDUP_TOKEN: void Xyz::Abc<int, int>()--bar--FOO()
+// CHECK1: DEDUP_TOKEN: {{void|.void}} Xyz::Abc<int, int>()
+// CHECK2: DEDUP_TOKEN: {{void|.void}} Xyz::Abc<int, int>()--{{bar|.bar}}
+// CHECK3: DEDUP_TOKEN: {{void|.void}} Xyz::Abc<int, int>()--{{bar|.bar}}--{{FOO|.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 <assert.h>
#include <stdio.h>
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 <sys/cdefs.h>
#include <sys/stat.h>
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 <assert.h>
#include <stdio.h>
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 <assert.h>
#include <inttypes.h>
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 <sys/param.h>
#include <sys/types.h>
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 <assert.h>
#include <stdio.h>
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 <time.h>
#include <unistd.h>
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 <assert.h>
#include <errno.h>
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 <sys/types.h>
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 <assert.h>
#include <stdio.h>
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..7d614e748e597 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,7 @@ int main(int argc, const char *argv[]) {
setgrent();
test<group>(&getgrent);
-#if !defined(__APPLE__) && !(defined(__sun__) && defined(__svr4__))
+#if !defined(__APPLE__) && !(defined(__sun__) && defined(__svr4__)) && !defined(_AIX)
setpwent();
test_r<passwd>(&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 <assert.h>
#include <spawn.h>
#include <stdio.h>
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 <stdio.h>
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 <assert.h>
#include <climits>
#include <errno.h>
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 <assert.h>
#include <errno.h>
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 <stdio.h>
#include <stdlib.h>
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 <stdio.h>
#include <stdlib.h>
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 <sys/param.h>
#include <sys/types.h>
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 <ctype.h>
#include <err.h>
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 <assert.h>
#include <stdlib.h>
#include <wchar.h>
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 <assert.h>
#include <string.h>
#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 <assert.h>
#include <errno.h>
#include <stdio.h>
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 <string.h>
#include <stdio.h>
#include <unistd.h>
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 <assert.h>
#include <errno.h>
#include <limits>
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..c35a5cb59e129 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|.__sanitizer_print_stack_trace)}}
+// CHECK: {{ #1 0x.* in (FooBarBaz|.FooBarBaz)(\(\))? .*}}print-stack-trace.cpp:[[@LINE-8]]
+// CHECK: {{ #2 0x.* in (main|.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|.__sanitizer_print_stack_trace}}
+// NOINLINE: #1 0x{{.*}} in {{main|.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 <cstdint>
#include <cstdio>
#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 <stdio.h>
#include <stdint.h>
#include <assert.h>
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 <assert.h>
#include <stdint.h>
#include <stdio.h>
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 <cstdint>
#include <cstdio>
#include <cassert>
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 <assert.h>
#include <string.h>
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..2bf5782db623c 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|.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..0bcb4115385c9 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/symbolize_pc.cpp
+++ b/compiler-rt/test/sanitizer_common/TestCases/symbolize_pc.cpp
@@ -72,12 +72,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|.main}} symbolize_pc.cpp:[[@LINE+2]]
+ // CHECK: SECOND_FORMAT FUNC:{{main|.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|.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..4133aacf9dc0a 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|._ZN10SymbolizerD2Ev}}
+// CHECK: in {{Symbolizer::~Symbolizer|.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..5baf695f1f99b 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|.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|.main}} symbolize_pc_inline.cpp:[[@LINE+1]]
int main() { C4(); }
>From e5470f649f5c493942ead24789148a2eefc4b904 Mon Sep 17 00:00:00 2001
From: Jake Egan <jake.egan at ibm.com>
Date: Thu, 24 Apr 2025 10:47:27 -0400
Subject: [PATCH 2/9] add_compiler_rt_cfg already exists
---
compiler-rt/cmake/Modules/AddCompilerRT.cmake | 17 -----------------
1 file changed, 17 deletions(-)
diff --git a/compiler-rt/cmake/Modules/AddCompilerRT.cmake b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
index d29ee07ccbdfe..d346b0ec01b03 100644
--- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake
+++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
@@ -582,23 +582,6 @@ macro(add_compiler_rt_script name)
DESTINATION ${COMPILER_RT_INSTALL_BINARY_DIR})
endmacro(add_compiler_rt_script src name)
-macro(add_compiler_rt_cfg target_name file_name component)
- set(src_file "${CMAKE_CURRENT_SOURCE_DIR}/${file_name}")
- get_compiler_rt_output_dir(${COMPILER_RT_DEFAULT_TARGET_ARCH} output_dir)
- set(dst_file "${output_dir}/${file_name}")
- add_custom_command(OUTPUT ${dst_file}
- DEPENDS ${src_file}
- COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src_file} ${dst_file}
- COMMENT "Copying ${file_name}...")
- add_custom_target(${target_name} DEPENDS ${dst_file})
- install(FILES ${file_name}
- DESTINATION ${COMPILER_RT_INSTALL_LIBRARY_DIR}
- COMPONENT ${component})
- add_dependencies(${component} ${target_name})
-
- set_target_properties(${target_name} PROPERTIES FOLDER "Compiler-RT Misc")
-endmacro()
-
# Builds custom version of libc++ and installs it in <prefix>.
# Can be used to build sanitized versions of libc++ for running unit tests.
# add_custom_libcxx(<name> <prefix>
>From 9f9944625c3017e8b8cc4324a62a110d929cd335 Mon Sep 17 00:00:00 2001
From: Jake Egan <jake.egan at ibm.com>
Date: Thu, 24 Apr 2025 11:07:23 -0400
Subject: [PATCH 3/9] Remove existing code
---
compiler-rt/cmake/base-config-ix.cmake | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/compiler-rt/cmake/base-config-ix.cmake b/compiler-rt/cmake/base-config-ix.cmake
index 953fa3983ecfc..d92bc0e71fa1a 100644
--- a/compiler-rt/cmake/base-config-ix.cmake
+++ b/compiler-rt/cmake/base-config-ix.cmake
@@ -14,11 +14,7 @@ include(CompilerRTDarwinUtils)
check_include_file(unwind.h HAVE_UNWIND_H)
# Used by sanitizer_common and tests.
-if (${CMAKE_SYSTEM_NAME} MATCHES AIX)
- check_include_file(tirpc/rpc/xdr.h HAVE_RPC_XDR_H)
-else()
- check_include_file(rpc/xdr.h HAVE_RPC_XDR_H)
-endif()
+check_include_file(rpc/xdr.h HAVE_RPC_XDR_H)
if (NOT HAVE_RPC_XDR_H)
set(HAVE_RPC_XDR_H 0)
endif()
>From 7cbe5516847ca5ff6b549fcc45c450f1b8432542 Mon Sep 17 00:00:00 2001
From: Jake Egan <jake.egan at ibm.com>
Date: Thu, 24 Apr 2025 11:24:49 -0400
Subject: [PATCH 4/9] enable tests
---
compiler-rt/test/asan/lit.cfg.py | 2 +-
compiler-rt/test/sanitizer_common/lit.common.cfg.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/compiler-rt/test/asan/lit.cfg.py b/compiler-rt/test/asan/lit.cfg.py
index 6da4753a64a82..e0e8ea31bec8a 100644
--- a/compiler-rt/test/asan/lit.cfg.py
+++ b/compiler-rt/test/asan/lit.cfg.py
@@ -323,7 +323,7 @@ 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/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:
>From 8a64a4a9885f8f13fa058b58d332f905576801a4 Mon Sep 17 00:00:00 2001
From: Jake Egan <jake.egan at ibm.com>
Date: Mon, 28 Apr 2025 00:37:39 -0400
Subject: [PATCH 5/9] aix doesn't have memalign
---
compiler-rt/lib/sanitizer_common/tests/sanitizer_test_utils.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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..245164caa8a8f 100644
--- a/compiler-rt/lib/sanitizer_common/tests/sanitizer_test_utils.h
+++ b/compiler-rt/lib/sanitizer_common/tests/sanitizer_test_utils.h
@@ -101,7 +101,7 @@ static inline uint32_t my_rand() {
#endif
#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__ANDROID__) && \
- !defined(__NetBSD__) && !defined(_WIN32)
+ !defined(__NetBSD__) && !defined(_WIN32) && !defined(_AIX)
# define SANITIZER_TEST_HAS_MEMALIGN 1
#else
# define SANITIZER_TEST_HAS_MEMALIGN 0
>From ad286326d8897ae6faf14b766b88242e96aacede Mon Sep 17 00:00:00 2001
From: Jake Egan <jake.egan at ibm.com>
Date: Mon, 28 Apr 2025 09:18:38 -0400
Subject: [PATCH 6/9] Handle some limitations
---
compiler-rt/lib/asan/tests/CMakeLists.txt | 8 +++++++-
compiler-rt/lib/sanitizer_common/tests/CMakeLists.txt | 4 ++++
2 files changed, 11 insertions(+), 1 deletion(-)
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()
>From 8ee3b9449ea157d82c95201fc58dda46ca23ae2b Mon Sep 17 00:00:00 2001
From: Jake Egan <jake.egan at ibm.com>
Date: Mon, 28 Apr 2025 21:40:07 -0400
Subject: [PATCH 7/9] Fix tests
---
.../test/asan/TestCases/Posix/asan-symbolize-sanity-test.cpp | 4 ++++
.../Posix/asan_symbolize_script/plugin_no_op_symbolicate.cpp | 4 ++++
.../asan_symbolize_script/plugin_wrong_frame_number_bug.cpp | 4 ++++
.../asan/TestCases/Posix/interception-in-shared-lib-test.cpp | 3 +++
compiler-rt/test/asan/TestCases/fakeframe-right-redzone.cpp | 2 +-
compiler-rt/test/asan/TestCases/global-location.cpp | 3 +++
.../TestCases/get_module_and_offset_for_pc.cpp | 4 ++++
compiler-rt/test/sanitizer_common/TestCases/symbolize_pc.cpp | 3 +++
8 files changed, 26 insertions(+), 1 deletion(-)
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 07a3b268846b3..19a7a9e41e01d 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 <dlfcn.h>
#include <stdio.h>
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 a41477f92dc4a..fa5d06fe484ba 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/interception-in-shared-lib-test.cpp b/compiler-rt/test/asan/TestCases/Posix/interception-in-shared-lib-test.cpp
index 67010cd6948f4..63eca7b1b1d06 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 && \
diff --git a/compiler-rt/test/asan/TestCases/fakeframe-right-redzone.cpp b/compiler-rt/test/asan/TestCases/fakeframe-right-redzone.cpp
index da1f5f2fb9789..cf06e565cd241 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|.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/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/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/<pid>/object/<object_id> 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 <assert.h>
diff --git a/compiler-rt/test/sanitizer_common/TestCases/symbolize_pc.cpp b/compiler-rt/test/sanitizer_common/TestCases/symbolize_pc.cpp
index 0bcb4115385c9..6b44ae3f10eb2 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
>From 4b9035f761888eafdf58f5eff4d64a6bbffdd1d6 Mon Sep 17 00:00:00 2001
From: Jake Egan <jake.egan at ibm.com>
Date: Tue, 29 Apr 2025 10:01:21 -0400
Subject: [PATCH 8/9] Remove changes from test
---
compiler-rt/test/asan/TestCases/invalid-free.cpp | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/compiler-rt/test/asan/TestCases/invalid-free.cpp b/compiler-rt/test/asan/TestCases/invalid-free.cpp
index 09228dc8ab69e..f550dc14a5a68 100644
--- a/compiler-rt/test/asan/TestCases/invalid-free.cpp
+++ b/compiler-rt/test/asan/TestCases/invalid-free.cpp
@@ -1,12 +1,9 @@
// RUN: %clangxx_asan -O0 %s -o %t
-// RUN: %if target={{.*aix.*}} %{ %env_asan_opts=enable_unmalloced_free_check=1 %} not %run %t 2>&1 \
-// RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=MALLOC-CTX
+// RUN: not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=MALLOC-CTX
// Also works if no malloc context is available.
-// RUN: %if target={{.*aix.*}} %{ %env_asan_opts=malloc_context_size=0:fast_unwind_on_malloc=0:enable_unmalloced_free_check=1 %} %else \
-// RUN: %{ %env_asan_opts=malloc_context_size=0:fast_unwind_on_malloc=0 %} not %run %t 2>&1 | FileCheck %s
-// RUN: %if target={{.*aix.*}} %{ %env_asan_opts=malloc_context_size=0:fast_unwind_on_malloc=1:enable_unmalloced_free_check=1 %} %else \
-// RUN: %{ %env_asan_opts=malloc_context_size=0:fast_unwind_on_malloc=1 %} not %run %t 2>&1 | FileCheck %s
+// RUN: %env_asan_opts=malloc_context_size=0:fast_unwind_on_malloc=0 not %run %t 2>&1 | FileCheck %s
+// RUN: %env_asan_opts=malloc_context_size=0:fast_unwind_on_malloc=1 not %run %t 2>&1 | FileCheck %s
// REQUIRES: stable-runtime
#include <stdlib.h>
>From 347279b69182687a1066c305c2bb8383454e0410 Mon Sep 17 00:00:00 2001
From: Jake Egan <jake.egan at ibm.com>
Date: Tue, 29 Apr 2025 14:44:36 -0400
Subject: [PATCH 9/9] Fix formatting
---
.../tests/sanitizer_test_utils.h | 2 +-
.../TestCases/Posix/new_array_cookie_test.cpp | 8 ++++----
.../TestCases/Posix/no_asan_gen_globals.c | 1 -
.../asan/TestCases/Posix/shared-lib-test.cpp | 2 +-
.../TestCases/Posix/start-deactivated.cpp | 20 +++++++++----------
.../test/asan/TestCases/debug_double_free.cpp | 2 +-
.../test/asan/TestCases/debug_report.cpp | 2 +-
.../asan/TestCases/suppressions-library.cpp | 1 -
.../test/asan/TestCases/zero_page_pc.cpp | 6 +++---
.../TestCases/Posix/getpw_getgr.cpp | 3 ++-
10 files changed, 23 insertions(+), 24 deletions(-)
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 245164caa8a8f..10cebd4d80486 100644
--- a/compiler-rt/lib/sanitizer_common/tests/sanitizer_test_utils.h
+++ b/compiler-rt/lib/sanitizer_common/tests/sanitizer_test_utils.h
@@ -102,7 +102,7 @@ static inline uint32_t my_rand() {
#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__ANDROID__) && \
!defined(__NetBSD__) && !defined(_WIN32) && !defined(_AIX)
-# define SANITIZER_TEST_HAS_MEMALIGN 1
+# define SANITIZER_TEST_HAS_MEMALIGN 1
#else
# define SANITIZER_TEST_HAS_MEMALIGN 0
#endif
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 614569b00f28a..c4dacc4ef26a2 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|.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|.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 136f150c94c7f..b1f24bb298618 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
@@ -7,7 +7,6 @@
// 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 b68d20bbb0a02..cf711caf81b1d 100644
--- a/compiler-rt/test/asan/TestCases/Posix/shared-lib-test.cpp
+++ b/compiler-rt/test/asan/TestCases/Posix/shared-lib-test.cpp
@@ -30,7 +30,7 @@ int main(int argc, char *argv[]) {
if (!inc) return 1;
printf("ok\n");
inc(1);
- inc(11); // BOOM, 11 is more robust than -1 as -1 requires the GLOB and pad are stored adjacent.
+ 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.*}}
diff --git a/compiler-rt/test/asan/TestCases/Posix/start-deactivated.cpp b/compiler-rt/test/asan/TestCases/Posix/start-deactivated.cpp
index f9bdb5cc85178..a1cc1cacc0a90 100644
--- a/compiler-rt/test/asan/TestCases/Posix/start-deactivated.cpp
+++ b/compiler-rt/test/asan/TestCases/Posix/start-deactivated.cpp
@@ -87,27 +87,27 @@ int main(int argc, char *argv[]) {
// After this line ASan is activated and starts detecting errors.
void *fn = dlsym(dso, "do_another_bad_thing");
if (!fn) {
- fprintf(stderr, "dlsym failed: %s\n", dlerror());
- return 1;
+ fprintf(stderr, "dlsym failed: %s\n", dlerror());
+ return 1;
}
// After activation: redzones.
for (int i = 1; i < HoneyPotSize; ++i) {
- honeyPot[i] = (char *)malloc(HoneyPotBlockSize);
- test_malloc_shadow(honeyPot[i], HoneyPotBlockSize, true);
+ honeyPot[i] = (char *)malloc(HoneyPotBlockSize);
+ test_malloc_shadow(honeyPot[i], HoneyPotBlockSize, true);
}
{
- char *p = (char *)malloc(HoneyPotBlockSize);
- test_malloc_shadow(p, HoneyPotBlockSize, true);
- free(p);
+ char *p = (char *)malloc(HoneyPotBlockSize);
+ test_malloc_shadow(p, HoneyPotBlockSize, true);
+ free(p);
}
for (int i = 1; i < HoneyPotSize; ++i)
- free(honeyPot[i]);
+ free(honeyPot[i]);
// Pre-existing allocations got redzones, too.
for (size_t sz = 1; sz < nPtrs; ++sz) {
- test_malloc_shadow(ptrs[sz], sz, true);
- free(ptrs[sz]);
+ test_malloc_shadow(ptrs[sz], sz, true);
+ free(ptrs[sz]);
}
// Test that ASAN_ACTIVATION_OPTIONS=allocator_may_return_null=1 has effect.
diff --git a/compiler-rt/test/asan/TestCases/debug_double_free.cpp b/compiler-rt/test/asan/TestCases/debug_double_free.cpp
index e4afaf0cf1821..981fc2eafd7b9 100644
--- a/compiler-rt/test/asan/TestCases/debug_double_free.cpp
+++ b/compiler-rt/test/asan/TestCases/debug_double_free.cpp
@@ -14,7 +14,7 @@
# endif
// Solaris libc omits the leading 0x.
#elif (defined(__sun__) && defined(__svr4__)) || defined(_AIX)
-# define PTR_FMT "0x%p"
+# define PTR_FMT "0x%p"
#else
# define PTR_FMT "%p"
#endif
diff --git a/compiler-rt/test/asan/TestCases/debug_report.cpp b/compiler-rt/test/asan/TestCases/debug_report.cpp
index 80cd9624523dd..733d95e4f8b3e 100644
--- a/compiler-rt/test/asan/TestCases/debug_report.cpp
+++ b/compiler-rt/test/asan/TestCases/debug_report.cpp
@@ -29,7 +29,7 @@ int main() {
# endif
// Solaris libc omits the leading 0x.
#elif (defined(__sun__) && defined(__svr4__)) || defined(_AIX)
-# define PTR_FMT "0x%p"
+# define PTR_FMT "0x%p"
#else
# define PTR_FMT "%p"
#endif
diff --git a/compiler-rt/test/asan/TestCases/suppressions-library.cpp b/compiler-rt/test/asan/TestCases/suppressions-library.cpp
index 78a1235c83c5b..d8fa0f6fc7517 100644
--- a/compiler-rt/test/asan/TestCases/suppressions-library.cpp
+++ b/compiler-rt/test/asan/TestCases/suppressions-library.cpp
@@ -17,7 +17,6 @@
// UNSUPPORTED: target={{.*aix.*}}
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/compiler-rt/test/asan/TestCases/zero_page_pc.cpp b/compiler-rt/test/asan/TestCases/zero_page_pc.cpp
index 0233b583992a8..e2789ba18b0de 100644
--- a/compiler-rt/test/asan/TestCases/zero_page_pc.cpp
+++ b/compiler-rt/test/asan/TestCases/zero_page_pc.cpp
@@ -9,10 +9,10 @@
# include <ptrauth.h>
#endif
-+// AIX reports illegal instruction error instead of SEGV while accesses address 0x4.
-+// UNSUPPORTED: aix
++ // AIX reports illegal instruction error instead of SEGV while accesses address 0x4.
+ + // UNSUPPORTED: aix
-typedef void void_f();
+ typedef void void_f();
int main() {
void_f *func = (void_f *)0x4;
#if __has_feature(ptrauth_calls)
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 7d614e748e597..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<group>(&getgrent);
-#if !defined(__APPLE__) && !(defined(__sun__) && defined(__svr4__)) && !defined(_AIX)
+# if !defined(__APPLE__) && !(defined(__sun__) && defined(__svr4__)) && \
+ !defined(_AIX)
setpwent();
test_r<passwd>(&getpwent_r);
setgrent();
More information about the llvm-commits
mailing list