[llvm] [LLVM] Pass correct target to LLVM_RUNTIMES_TARGET for runtimes (PR #136572)

Joseph Huber via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 21 08:42:16 PDT 2025


https://github.com/jhuber6 created https://github.com/llvm/llvm-project/pull/136572

Summary:
When doing a multilib build, we pass `+feature` as the canonical runtime
name. Currently, this is being passed through to the
`LLVM_RUNTIMES_TARGET` which is supposed to imply the cross-compiling
target as a triple. The `+feature` will be present, making it invalid.
This patch separates the runtimes name from the target name.


>From 57247699c7858f626de3e069fd88d23df6bbc025 Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Mon, 21 Apr 2025 10:37:31 -0500
Subject: [PATCH] [LLVM] Pass correct target to LLVM_RUNTIMES_TARGET for
 runtimes

Summary:
When doing a multilib build, we pass `+feature` as the canonical runtime
name. Currently, this is being passed through to the
`LLVM_RUNTIMES_TARGET` which is supposed to imply the cross-compiling
target as a triple. The `+feature` will be present, making it invalid.
This patch separates the runtimes name from the target name.
---
 llvm/runtimes/CMakeLists.txt | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt
index 51433d1ec9831..01cc05179293e 100644
--- a/llvm/runtimes/CMakeLists.txt
+++ b/llvm/runtimes/CMakeLists.txt
@@ -297,9 +297,9 @@ function(runtime_default_target)
                            ${EXTRA_ARGS} ${ARG_EXTRA_ARGS})
 endfunction()
 
-# runtime_register_target(name)
+# runtime_register_target(name target)
 #   Utility function to register external runtime target.
-function(runtime_register_target name)
+function(runtime_register_target name target)
   cmake_parse_arguments(ARG "" "BASE_NAME" "DEPENDS;CMAKE_ARGS;EXTRA_ARGS" ${ARGN})
   include(${LLVM_BINARY_DIR}/runtimes/${name}/Components.cmake OPTIONAL)
   set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${LLVM_BINARY_DIR}/runtimes/${name}/Components.cmake)
@@ -414,7 +414,7 @@ function(runtime_register_target name)
                                       -DCMAKE_Fortran_COMPILER_WORKS=ON
                                       -DCMAKE_ASM_COMPILER_WORKS=ON
                                       -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON
-                                      -DLLVM_RUNTIMES_TARGET=${name}
+                                      -DLLVM_RUNTIMES_TARGET=${target}
                                       ${COMMON_CMAKE_ARGS}
                                       ${${name}_extra_args}
                            EXTRA_TARGETS ${${name}_extra_targets}
@@ -605,7 +605,7 @@ if(build_runtimes)
 
       check_apple_target(${name} runtime)
 
-      runtime_register_target(${name}
+      runtime_register_target(${name} ${name}
         DEPENDS ${builtins_dep_name} ${extra_deps}
         CMAKE_ARGS -DLLVM_DEFAULT_TARGET_TRIPLE=${name} ${extra_cmake_args}
         EXTRA_ARGS TARGET_TRIPLE ${name} ${extra_args})
@@ -613,7 +613,7 @@ if(build_runtimes)
 
     foreach(multilib ${LLVM_RUNTIME_MULTILIBS})
       foreach(name ${LLVM_RUNTIME_MULTILIB_${multilib}_TARGETS})
-        runtime_register_target(${name}+${multilib}
+        runtime_register_target(${name}+${multilib} ${name}
           DEPENDS runtimes-${name}
           CMAKE_ARGS -DLLVM_DEFAULT_TARGET_TRIPLE=${name}
                      -DLLVM_RUNTIMES_PREFIX=${name}/



More information about the llvm-commits mailing list