Skip to content

Commit 224ec83

Browse files
authored
[AIX] Opt in to per-target runtime dir (#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.
1 parent 1ffdf53 commit 224ec83

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

compiler-rt/cmake/Modules/CompilerRTUtils.cmake

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,12 @@ macro(construct_compiler_rt_default_triple)
373373
message(STATUS "cmake c compiler target: ${CMAKE_C_COMPILER_TARGET}")
374374
set(COMPILER_RT_DEFAULT_TARGET_TRIPLE ${CMAKE_C_COMPILER_TARGET})
375375
else()
376-
set(COMPILER_RT_DEFAULT_TARGET_TRIPLE ${LLVM_TARGET_TRIPLE} CACHE STRING
376+
set(target_triple ${LLVM_TARGET_TRIPLE})
377+
# AIX triples can have OS version numbers we don't want for the compiler-rt target.
378+
if (target_triple MATCHES "aix")
379+
string(REGEX REPLACE "[0-9.]+$" "" target_triple "${target_triple}")
380+
endif()
381+
set(COMPILER_RT_DEFAULT_TARGET_TRIPLE ${target_triple} CACHE STRING
377382
"Default triple for which compiler-rt runtimes will be built.")
378383
endif()
379384

llvm/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -976,7 +976,7 @@ endif()
976976
set(LLVM_TARGET_TRIPLE_ENV CACHE STRING "The name of environment variable to override default target. Disabled by blank.")
977977
mark_as_advanced(LLVM_TARGET_TRIPLE_ENV)
978978

979-
if(CMAKE_SYSTEM_NAME MATCHES "BSD|Linux|OS390")
979+
if(CMAKE_SYSTEM_NAME MATCHES "BSD|Linux|OS390|AIX")
980980
set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default ON)
981981
else()
982982
set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default OFF)

llvm/runtimes/CMakeLists.txt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,7 @@ endfunction()
7373
macro(set_enable_per_target_runtime_dir)
7474
# May have been set by llvm/CMakeLists.txt.
7575
if (NOT DEFINED LLVM_ENABLE_PER_TARGET_RUNTIME_DIR)
76-
# AIX should fold 32-bit & 64-bit arch libraries into a single archive.
77-
if (LLVM_TARGET_TRIPLE MATCHES "aix")
78-
set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR OFF)
79-
else()
80-
set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR ON)
81-
endif()
76+
set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR ON)
8277
endif()
8378
endmacro()
8479

0 commit comments

Comments
 (0)