[libc-commits] [libc] [libc] Fix passing the full runtime target for multilibs (PR #136208)

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Thu Apr 17 14:41:05 PDT 2025


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

Summary:
The multilib builds pass `+name` to the runtime target. We were using
this as a strict triple and passing it to the compiler. Parse out the
triple portion in this case.


>From 782ea2f79da3000775563dc1989c955f14ba2d9e Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Thu, 17 Apr 2025 16:39:19 -0500
Subject: [PATCH] [libc] Fix passing the full runtime target for multilibs

Summary:
The multilib builds pass `+name` to the runtime target. We were using
this as a strict triple and passing it to the compiler. Parse out the
triple portion in this case.
---
 libc/cmake/modules/LLVMLibCArchitectures.cmake | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libc/cmake/modules/LLVMLibCArchitectures.cmake b/libc/cmake/modules/LLVMLibCArchitectures.cmake
index 62f3a2e3bdb59..d2046d9270063 100644
--- a/libc/cmake/modules/LLVMLibCArchitectures.cmake
+++ b/libc/cmake/modules/LLVMLibCArchitectures.cmake
@@ -211,6 +211,12 @@ if(explicit_target_triple AND
             "GCC target triple (${libc_compiler_triple}) and the explicity "
             "specified target triple (${explicit_target_triple}) do not match.")
   else()
+    # Make sure we don't include any multilib specifiers.
+    string(FIND "${explicit_target_triple}" "+" plus_pos)
+    if(NOT plus_pos EQUAL -1)
+      string(SUBSTRING "${explicit_target_triple}" 0 ${plus_pos} explicit_target_triple)
+    endif()
+
     list(APPEND
          LIBC_COMPILE_OPTIONS_DEFAULT "--target=${explicit_target_triple}")
   endif()



More information about the libc-commits mailing list