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

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


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Joseph Huber (jhuber6)

<details>
<summary>Changes</summary>

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.


---
Full diff: https://github.com/llvm/llvm-project/pull/136208.diff


1 Files Affected:

- (modified) libc/cmake/modules/LLVMLibCArchitectures.cmake (+6) 


``````````diff
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()

``````````

</details>


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


More information about the libc-commits mailing list