[libc-commits] [libc] b1acd6d - [libc] Remove faccessat entrypoint if faccessat2 syscall is not available (#164936)

via libc-commits libc-commits at lists.llvm.org
Thu Oct 30 10:35:24 PDT 2025


Author: Marcell Leleszi
Date: 2025-10-30T10:35:20-07:00
New Revision: b1acd6df03d3e0dfaee00191a807142a65b2e212

URL: https://github.com/llvm/llvm-project/commit/b1acd6df03d3e0dfaee00191a807142a65b2e212
DIFF: https://github.com/llvm/llvm-project/commit/b1acd6df03d3e0dfaee00191a807142a65b2e212.diff

LOG: [libc] Remove faccessat entrypoint if faccessat2 syscall is not available (#164936)

[#163091](https://github.com/llvm/llvm-project/issues/163091)

Remove unistd.faccessat entrypoint for x86 linux if faccessat2 syscall
is not available. Tested with non existent symbol and exclusion works.

Added: 
    

Modified: 
    libc/CMakeLists.txt
    libc/config/linux/x86_64/exclude.txt

Removed: 
    


################################################################################
diff  --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index 14718e2090bde..ae555a256ba66 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -363,7 +363,7 @@ elseif(LLVM_LIBC_FULL_BUILD)
   message(FATAL_ERROR "${LIBC_CONFIG_PATH}/headers.txt file not found and fullbuild requested.")
 endif()
 
-# Check exclude.txt that appends to LIBC_EXCLUDE_ENTRYPOINTS list
+# Check exclude.txt that appends to TARGET_LLVMLIBC_REMOVED_ENTRYPOINTS list
 if(EXISTS "${LIBC_CONFIG_PATH}/exclude.txt")
     include("${LIBC_CONFIG_PATH}/exclude.txt")
 endif()

diff  --git a/libc/config/linux/x86_64/exclude.txt b/libc/config/linux/x86_64/exclude.txt
index 2c218b753b176..a0686310d21ac 100644
--- a/libc/config/linux/x86_64/exclude.txt
+++ b/libc/config/linux/x86_64/exclude.txt
@@ -19,3 +19,11 @@ if(NOT has_sys_random)
     )
   endif()
 endif()
+
+include(CheckSymbolExists)
+check_symbol_exists(SYS_faccessat2 "sys/syscall.h" HAVE_SYS_FACCESSAT2)
+if(NOT HAVE_SYS_FACCESSAT2)
+  list(APPEND TARGET_LLVMLIBC_REMOVED_ENTRYPOINTS
+    libc.src.unistd.faccessat
+  )
+endif()


        


More information about the libc-commits mailing list