[libcxx-commits] [libcxxabi] 4fc7019 - [libc++][AIX] Add OS version to target triple
Jake Egan via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Oct 31 13:30:38 PDT 2023
Author: Jake Egan
Date: 2023-10-31T16:23:05-04:00
New Revision: 4fc70197919cded66502d1ad853f9e7f344b9a77
URL: https://github.com/llvm/llvm-project/commit/4fc70197919cded66502d1ad853f9e7f344b9a77
DIFF: https://github.com/llvm/llvm-project/commit/4fc70197919cded66502d1ad853f9e7f344b9a77.diff
LOG: [libc++][AIX] Add OS version to target triple
This will allow for configuring tests according to AIX version.
Reviewed By: daltenty, #libc, Mordante
Differential Revision: https://reviews.llvm.org/D149660
Added:
Modified:
libcxx/test/configs/ibm-libc++-shared.cfg.in
libcxxabi/test/configs/ibm-libc++abi-shared.cfg.in
libunwind/test/configs/ibm-libunwind-shared.cfg.in
libunwind/test/signal_frame.pass.cpp
llvm/utils/lit/lit/util.py
Removed:
################################################################################
diff --git a/libcxx/test/configs/ibm-libc++-shared.cfg.in b/libcxx/test/configs/ibm-libc++-shared.cfg.in
index 7881556603cfa74..50061e9717ce063 100644
--- a/libcxx/test/configs/ibm-libc++-shared.cfg.in
+++ b/libcxx/test/configs/ibm-libc++-shared.cfg.in
@@ -4,6 +4,12 @@
lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
+import lit.util
+if lit.util.isAIXTriple(config.target_triple):
+ # Add the AIX version to the triple here because there currently isn't a good
+ # way to retrieve the AIX version in the driver.
+ config.target_triple = lit.util.addAIXVersion(config.target_triple)
+
config.substitutions.append(('%{flags}', '-pthread'))
config.substitutions.append(('%{compile_flags}',
'-nostdinc++ -D__LIBC_NO_CPP_MATH_OVERLOADS__ -I %{include} -I %{libcxx}/test/support'
diff --git a/libcxxabi/test/configs/ibm-libc++abi-shared.cfg.in b/libcxxabi/test/configs/ibm-libc++abi-shared.cfg.in
index 2a9bc9061566fa4..bd6c1fb135aaa92 100644
--- a/libcxxabi/test/configs/ibm-libc++abi-shared.cfg.in
+++ b/libcxxabi/test/configs/ibm-libc++abi-shared.cfg.in
@@ -2,6 +2,12 @@
lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
+import lit.util
+if lit.util.isAIXTriple(config.target_triple):
+ # Add the AIX version to the triple here because there currently isn't a good
+ # way to retrieve the AIX version in the driver.
+ config.target_triple = lit.util.addAIXVersion(config.target_triple)
+
config.substitutions.append(('%{flags}',''))
config.substitutions.append(('%{compile_flags}',
'-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} %{maybe-include-libunwind} ' +
diff --git a/libunwind/test/configs/ibm-libunwind-shared.cfg.in b/libunwind/test/configs/ibm-libunwind-shared.cfg.in
index c38d278ad2c9cd4..2221e0cf499ff21 100644
--- a/libunwind/test/configs/ibm-libunwind-shared.cfg.in
+++ b/libunwind/test/configs/ibm-libunwind-shared.cfg.in
@@ -3,6 +3,12 @@
lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
+import lit.util
+if lit.util.isAIXTriple(config.target_triple):
+ # Add the AIX version to the triple here because there currently isn't a good
+ # way to retrieve the AIX version in the driver.
+ config.target_triple = lit.util.addAIXVersion(config.target_triple)
+
config.substitutions.append(('%{flags}', ''))
config.substitutions.append(('%{compile_flags}',
'-nostdinc++ -I %{include}'
diff --git a/libunwind/test/signal_frame.pass.cpp b/libunwind/test/signal_frame.pass.cpp
index e5409f6ce3d9973..004029cfe1e90b2 100644
--- a/libunwind/test/signal_frame.pass.cpp
+++ b/libunwind/test/signal_frame.pass.cpp
@@ -19,7 +19,7 @@
// The AIX assembler does not support CFI directives, which
// are necessary to run this test.
-// UNSUPPORTED: target=powerpc{{(64)?}}-ibm-aix
+// UNSUPPORTED: target={{.*}}-aix{{.*}}
// Windows doesn't generally use CFI directives. However, i686
// mingw targets do use DWARF (where CFI directives are supported).
diff --git a/llvm/utils/lit/lit/util.py b/llvm/utils/lit/lit/util.py
index c8d7ec62a57458d..232ddc9171ad3d6 100644
--- a/llvm/utils/lit/lit/util.py
+++ b/llvm/utils/lit/lit/util.py
@@ -6,6 +6,7 @@
import numbers
import os
import platform
+import re
import signal
import subprocess
import sys
@@ -429,6 +430,22 @@ def killProcess():
return out, err, exitCode
+def isAIXTriple(target_triple):
+ """Whether the given target triple is for AIX,
+ e.g. powerpc64-ibm-aix
+ """
+ return "aix" in target_triple
+
+
+def addAIXVersion(target_triple):
+ """Add the AIX version to the given target triple,
+ e.g. powerpc64-ibm-aix7.2.5.6
+ """
+ os_cmd = "oslevel -s | awk -F\'-\' \'{printf \"%.1f.%d.%d\", $1/1000, $2, $3}\'"
+ os_version = subprocess.run(os_cmd, capture_output=True, shell=True).stdout.decode()
+ return re.sub("aix", "aix" + os_version, target_triple)
+
+
def isMacOSTriple(target_triple):
"""Whether the given target triple is for macOS,
e.g. x86_64-apple-darwin, arm64-apple-macos
More information about the libcxx-commits
mailing list