[llvm] [flang-rt] replace the triple dir to 'aix' for flang-rt to be consistent with clang on AIX. (PR #130875)

Daniel Chen via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 14 11:32:16 PDT 2025


https://github.com/DanielCChen updated https://github.com/llvm/llvm-project/pull/130875

>From 0644e33b675a2d5c3f8541bff4f04c854d697dfc Mon Sep 17 00:00:00 2001
From: Daniel Chen <cdchen at ca.ibm.com>
Date: Tue, 11 Mar 2025 21:29:51 -0400
Subject: [PATCH 1/2] [flang-rt] replace the triple dir to 'aix' for flang-rt
 to be consistent with clang on AIX.

---
 flang-rt/cmake/modules/GetToolchainDirs.cmake | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/flang-rt/cmake/modules/GetToolchainDirs.cmake b/flang-rt/cmake/modules/GetToolchainDirs.cmake
index fba12502b5946..9d05007d34123 100644
--- a/flang-rt/cmake/modules/GetToolchainDirs.cmake
+++ b/flang-rt/cmake/modules/GetToolchainDirs.cmake
@@ -118,6 +118,9 @@ function (get_toolchain_arch_dirname outvar)
     set(target "amdgcn-amd-amdhsa")
   elseif("${arch}" MATCHES "^nvptx")
     set(target "nvptx64-nvidia-cuda")
+  elseif(UNIX AND CMAKE_SYSTEM_NAME MATCHES "AIX")
+    # Put at lib/aix to be consistent with clang on AIX.
+    string(TOLOWER "${CMAKE_SYSTEM_NAME}" target)
   else()
     set(target "${arch}${triple_suffix}")
   endif()

>From 960d2073a428a42b1955ca8e56a245214a699615 Mon Sep 17 00:00:00 2001
From: Daniel Chen <cdchen at ca.ibm.com>
Date: Fri, 14 Mar 2025 13:39:02 -0400
Subject: [PATCH 2/2] [flang-rt] Using get_toolchain_os_dirname for AIX to get
 lib path instead of changing get_toolchain_arch_dirname.

---
 flang-rt/cmake/modules/GetToolchainDirs.cmake | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/flang-rt/cmake/modules/GetToolchainDirs.cmake b/flang-rt/cmake/modules/GetToolchainDirs.cmake
index 9d05007d34123..8b384180bcc31 100644
--- a/flang-rt/cmake/modules/GetToolchainDirs.cmake
+++ b/flang-rt/cmake/modules/GetToolchainDirs.cmake
@@ -34,8 +34,9 @@
 function (get_toolchain_library_subdir outvar)
   set(outval "lib")
 
-  if (APPLE)
+  if (APPLE OR (UNIX AND CMAKE_SYSTEM_NAME MATCHES "AIX"))
     # Required to be "darwin" for MachO toolchain.
+    # AIX uses lib/${os_dir} as if LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
     get_toolchain_os_dirname(os_dirname)
     set(outval "${outval}/${os_dirname}")
   else ()
@@ -118,9 +119,6 @@ function (get_toolchain_arch_dirname outvar)
     set(target "amdgcn-amd-amdhsa")
   elseif("${arch}" MATCHES "^nvptx")
     set(target "nvptx64-nvidia-cuda")
-  elseif(UNIX AND CMAKE_SYSTEM_NAME MATCHES "AIX")
-    # Put at lib/aix to be consistent with clang on AIX.
-    string(TOLOWER "${CMAKE_SYSTEM_NAME}" target)
   else()
     set(target "${arch}${triple_suffix}")
   endif()



More information about the llvm-commits mailing list