[libcxx][AIX] Switch build compiler to clang

This patch switches the build compiler for AIX from ibm-clang to clang. ibm-clang++_r has `-pthread` by default, but clang for AIX doesn't, so `-pthread` had to be added to the test config. A bunch of tests now pass, so the `XFAIL` was removed. This patch also switch the build to use the visibility support available in clang-15 to control symbols exported by the shared library (AIX traditionally uses explicit export lists for this purpose).

Reviewed By: #libc, #libc_abi, daltenty, #libunwind, ldionne

Differential Revision: https://reviews.llvm.org/D127470

GitOrigin-RevId: 1cf4113952ae3e4cc75decdf6feb3ce5dd8ca4a1
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 722499e..b8326d0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -241,6 +241,11 @@
   add_target_flags_if_supported("-fzos-le-char-mode=ebcdic")
 endif()
 
+if (${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  add_target_flags_if_supported("-mdefault-visibility-export-mapping=explicit")
+  set(CMAKE_AIX_EXPORT_ALL_SYMBOLS OFF)
+endif()
+
 # Configure compiler. Must happen after setting the target flags.
 include(config-ix)
 
diff --git a/test/configs/ibm-libc++abi-shared.cfg.in b/test/configs/ibm-libc++abi-shared.cfg.in
index 402841f..3d1175a 100644
--- a/test/configs/ibm-libc++abi-shared.cfg.in
+++ b/test/configs/ibm-libc++abi-shared.cfg.in
@@ -7,7 +7,7 @@
     '-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} %{maybe-include-libunwind} ' +
     '-D__LIBC_NO_CPP_MATH_OVERLOADS__ ' +
     '-D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS ' +
-    '-I %{libcxx}/test/support -I %{libcxx}/src'
+    '-I %{libcxx}/test/support -pthread -I %{libcxx}/src'
 ))
 config.substitutions.append(('%{link_flags}',
     '-nostdlib++ -L %{lib} -lc++ -lc++abi -Wl,-bbigtoc'