[libcxx-commits] [PATCH] D149660: [libc++][AIX] Add OS version to target triple

Jake Egan via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Oct 31 13:30:43 PDT 2023


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4fc70197919c: [libc++][AIX] Add OS version to target triple (authored by Jake-Egan).
Herald added a project: libc++abi.
Herald added 1 blocking reviewer(s): libc++abi.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149660/new/

https://reviews.llvm.org/D149660

Files:
  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


Index: llvm/utils/lit/lit/util.py
===================================================================
--- llvm/utils/lit/lit/util.py
+++ 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 @@
     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
Index: libunwind/test/signal_frame.pass.cpp
===================================================================
--- libunwind/test/signal_frame.pass.cpp
+++ 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).
Index: libunwind/test/configs/ibm-libunwind-shared.cfg.in
===================================================================
--- libunwind/test/configs/ibm-libunwind-shared.cfg.in
+++ 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}'
Index: libcxxabi/test/configs/ibm-libc++abi-shared.cfg.in
===================================================================
--- libcxxabi/test/configs/ibm-libc++abi-shared.cfg.in
+++ 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} ' +
Index: libcxx/test/configs/ibm-libc++-shared.cfg.in
===================================================================
--- libcxx/test/configs/ibm-libc++-shared.cfg.in
+++ 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'


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149660.557952.patch
Type: text/x-patch
Size: 3880 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20231031/68576a63/attachment.bin>


More information about the libcxx-commits mailing list