[llvm] [Runtimes][libc] Include kernel headers when using RUNIMES_USE_LIBC (PR #165114)
    Aiden Grossman via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Sat Oct 25 12:39:34 PDT 2025
    
    
  
https://github.com/boomanaiden154 created https://github.com/llvm/llvm-project/pull/165114
When setting RUNTIMES_USE_LIBC=libc we pass -nostdlibinc if the compiler
supports it. This causes compilation failures when trying to build
libc++ as libc will try and reference kernel headers in its own headers
that it now cannot find. Explicitly reference the kernel headers so the
compiler can find them.
>From 5d5ff26e2d72f42938115dee06828ba282393680 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <aidengrossman at google.com>
Date: Sat, 25 Oct 2025 19:39:23 +0000
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
 =?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Created using spr 1.3.7
---
 runtimes/cmake/Modules/HandleLibC.cmake | 1 +
 1 file changed, 1 insertion(+)
diff --git a/runtimes/cmake/Modules/HandleLibC.cmake b/runtimes/cmake/Modules/HandleLibC.cmake
index 51fbf04df7e3b..01da5b260d3d4 100644
--- a/runtimes/cmake/Modules/HandleLibC.cmake
+++ b/runtimes/cmake/Modules/HandleLibC.cmake
@@ -30,6 +30,7 @@ elseif (RUNTIMES_USE_LIBC STREQUAL "llvm-libc")
   check_cxx_compiler_flag(-nostdlibinc CXX_SUPPORTS_NOSTDLIBINC_FLAG)
   if(CXX_SUPPORTS_NOSTDLIBINC_FLAG)
     target_compile_options(runtimes-libc-headers INTERFACE "-nostdlibinc")
+    target_compile_options(runtimes-libc-headers INTERFACE "-idirafter${LIBC_KERNEL_HEADERS}")
   endif()
 
   add_library(runtimes-libc-static INTERFACE)
    
    
More information about the llvm-commits
mailing list