[libc-commits] [libc] [libc] Fix OS when using `-llvm` OS in the triple (PR #181908)

via libc-commits libc-commits at lists.llvm.org
Tue Feb 17 13:05:52 PST 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Joseph Huber (jhuber6)

<details>
<summary>Changes</summary>

Summary:
We spoof the OS name for the GPU targets and used to get it form the
'end' of the triple list. Adding `-llvm` makes that now point to `-llvm`
which is not recognized so it fails. Just use the direct index, we
already guard that the triple is the correct size


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


1 Files Affected:

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


``````````diff
diff --git a/libc/cmake/modules/LLVMLibCArchitectures.cmake b/libc/cmake/modules/LLVMLibCArchitectures.cmake
index 94c978a458a6d..bb96c07b1e7a7 100644
--- a/libc/cmake/modules/LLVMLibCArchitectures.cmake
+++ b/libc/cmake/modules/LLVMLibCArchitectures.cmake
@@ -70,7 +70,7 @@ function(get_arch_and_system_from_triple triple arch_var sys_var)
   endif()
 
   # Setting OS name for GPU architectures.
-  list(GET triple_comps -1 gpu_target_sys)
+  list(GET triple_comps 2 gpu_target_sys)
   if(gpu_target_sys MATCHES "^amdhsa" OR gpu_target_sys MATCHES "^cuda" OR target_arch MATCHES "^spirv")
     set(target_sys "gpu")
   endif()

``````````

</details>


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


More information about the libc-commits mailing list