[compiler-rt] [llvm] [AIX] Opt in to per-target runtime dir (PR #139620)
David Tenty via llvm-commits
llvm-commits at lists.llvm.org
Mon May 12 13:39:09 PDT 2025
https://github.com/daltenty created https://github.com/llvm/llvm-project/pull/139620
Many targets have already migrated to the per-target runtime directory layout, which is generally preferred. For AIX however, we are currently using per-target runtime directories by default for some runtimes (i.e. `flang-rt`) but not others. This change makes things consistent for other runtimes (most primarily `compiler-rt`) as well, adopting the layout uniformly for the AIX target.
This change also normalizes the triple used for building compiler-rt to remove any OS version number, as there is currently no need to version the runtimes this way and the driver code doesn't expect this anyhow.
>From 008e440d40c16adbddb4eeb483a6f7fda0cc8581 Mon Sep 17 00:00:00 2001
From: David Tenty <daltenty at ibm.com>
Date: Wed, 7 May 2025 16:10:07 -0400
Subject: [PATCH 1/2] [AIX] Opt in to per-target-runtime dir
---
llvm/CMakeLists.txt | 2 +-
llvm/runtimes/CMakeLists.txt | 7 +------
2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index e8d9ec0d6153a..91bedba8a548d 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -976,7 +976,7 @@ endif()
set(LLVM_TARGET_TRIPLE_ENV CACHE STRING "The name of environment variable to override default target. Disabled by blank.")
mark_as_advanced(LLVM_TARGET_TRIPLE_ENV)
-if(CMAKE_SYSTEM_NAME MATCHES "BSD|Linux|OS390")
+if(CMAKE_SYSTEM_NAME MATCHES "BSD|Linux|OS390|AIX")
set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default ON)
else()
set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default OFF)
diff --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt
index 670e3ae84870a..cabadfc9184f8 100644
--- a/llvm/runtimes/CMakeLists.txt
+++ b/llvm/runtimes/CMakeLists.txt
@@ -73,12 +73,7 @@ endfunction()
macro(set_enable_per_target_runtime_dir)
# May have been set by llvm/CMakeLists.txt.
if (NOT DEFINED LLVM_ENABLE_PER_TARGET_RUNTIME_DIR)
- # AIX should fold 32-bit & 64-bit arch libraries into a single archive.
- if (LLVM_TARGET_TRIPLE MATCHES "aix")
- set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR OFF)
- else()
- set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR ON)
- endif()
+ set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR ON)
endif()
endmacro()
>From 392705bd6c58c13247143a1a7d933240dcdffb01 Mon Sep 17 00:00:00 2001
From: David Tenty <daltenty at ibm.com>
Date: Mon, 12 May 2025 11:41:23 -0400
Subject: [PATCH 2/2] Leave the version number out for compiler-rt
---
compiler-rt/cmake/Modules/CompilerRTUtils.cmake | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
index 966a084a535dc..03db38fa4cdc1 100644
--- a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
+++ b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
@@ -373,7 +373,12 @@ macro(construct_compiler_rt_default_triple)
message(STATUS "cmake c compiler target: ${CMAKE_C_COMPILER_TARGET}")
set(COMPILER_RT_DEFAULT_TARGET_TRIPLE ${CMAKE_C_COMPILER_TARGET})
else()
- set(COMPILER_RT_DEFAULT_TARGET_TRIPLE ${LLVM_TARGET_TRIPLE} CACHE STRING
+ set(target_triple ${LLVM_TARGET_TRIPLE})
+ # AIX triples can have OS version numbers we don't want for the compiler-rt target.
+ if (target_triple MATCHES "aix")
+ string(REGEX REPLACE "[0-9.]+$" "" target_triple "${target_triple}")
+ endif()
+ set(COMPILER_RT_DEFAULT_TARGET_TRIPLE ${target_triple} CACHE STRING
"Default triple for which compiler-rt runtimes will be built.")
endif()
More information about the llvm-commits
mailing list