[libc-commits] [libc] [libc] Allow libc to build on Red Hat (PR #83517)

via libc-commits libc-commits at lists.llvm.org
Thu Feb 29 18:30:13 PST 2024


https://github.com/jameshu15869 created https://github.com/llvm/llvm-project/pull/83517

Currently, `libc` fails when building on redhat because the triple format uses `redhat` instead of `linux` (The same problem as openSUSE). This PR changes `libc` to accept `redhat` as a valid Linux triple. 

>From 0f1b57990bbb86b4f65fb77f10e7cf74e5f0a659 Mon Sep 17 00:00:00 2001
From: James Hu <jhudson15869 at gmail.com>
Date: Thu, 29 Feb 2024 21:27:22 -0500
Subject: [PATCH] [libc] allow libc to build on redhat

---
 libc/cmake/modules/LLVMLibCArchitectures.cmake | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libc/cmake/modules/LLVMLibCArchitectures.cmake b/libc/cmake/modules/LLVMLibCArchitectures.cmake
index 0dbc59ad643ac4..66acf95058bcb3 100644
--- a/libc/cmake/modules/LLVMLibCArchitectures.cmake
+++ b/libc/cmake/modules/LLVMLibCArchitectures.cmake
@@ -167,13 +167,13 @@ if(LIBC_TARGET_OS STREQUAL "baremetal")
   set(LIBC_TARGET_OS_IS_BAREMETAL TRUE)
 elseif(LIBC_TARGET_OS STREQUAL "linux")
   set(LIBC_TARGET_OS_IS_LINUX TRUE)
-elseif(LIBC_TARGET_OS STREQUAL "poky" OR LIBC_TARGET_OS STREQUAL "suse")
-  # poky are ustom Linux-base systems created by yocto. Since these are Linux
+elseif(LIBC_TARGET_OS STREQUAL "poky" OR LIBC_TARGET_OS STREQUAL "suse" OR LIBC_TARGET_OS STREQUAL "redhat")
+  # poky are custom Linux-base systems created by yocto. Since these are Linux
   # images, we change the LIBC_TARGET_OS to linux. This define is used to
   # include the right directories during compilation.
   #
-  # openSUSE uses different triple format which causes LIBC_TARGET_OS to be
-  # computed as "suse" instead of "linux".
+  # openSUSE and redhat use different triple format which causes LIBC_TARGET_OS
+  # to be computed as "suse" or "redhat" instead of "linux".
   set(LIBC_TARGET_OS_IS_LINUX TRUE)
   set(LIBC_TARGET_OS "linux")
 elseif(LIBC_TARGET_OS STREQUAL "darwin")



More information about the libc-commits mailing list