Skip to content

[libc] Add LLVM_LIBC_ENABLE_EXPERIMENTAL_ENTRYPOINTS CMake flag#197537

Merged
kaladron merged 2 commits into
llvm:mainfrom
kaladron:experimental
May 14, 2026
Merged

[libc] Add LLVM_LIBC_ENABLE_EXPERIMENTAL_ENTRYPOINTS CMake flag#197537
kaladron merged 2 commits into
llvm:mainfrom
kaladron:experimental

Conversation

@kaladron
Copy link
Copy Markdown
Member

Adds a new CMake option, OFF by default, to gate entrypoints with known-incomplete implementations. This lets developers build and test partially-implemented functions without exposing them to production users.

The motivating case is sysconf, which only handles three of the required _SC_* constants (_SC_PAGESIZE, _SC_NPROCESSORS_CONF, _SC_NPROCESSORS_ONLN) and returns EINVAL for everything else. Functions like this are useful to have in a build for testing progress, but shouldn't be part of a default full build until the implementation is complete.

Changes:

  • libc/CMakeLists.txt: adds option(LLVM_LIBC_ENABLE_EXPERIMENTAL_ENTRYPOINTS ... OFF)
  • libc/cmake/modules/LLVMLibCCompileOptionRules.cmake: propagates -DLIBC_EXPERIMENTAL_ENTRYPOINTS when ON
  • libc/cmake/modules/LLVMLibCTestRules.cmake: same for test compile options
  • libc/config/linux/{x86_64,aarch64,riscv}/entrypoints.txt: moves sysconf behind the new flag

The flag does not require LLVM_LIBC_FULL_BUILD since overlay builds may also have incomplete entrypoints that benefit from this gating.

Adds a new CMake option, OFF by default, to gate entrypoints with
known-incomplete implementations. This lets developers build with
partially-implemented functions for testing or development without
exposing them to production users.

Moved sysconf behind the new flag across x86_64, aarch64, and riscv.
The implementation only handles _SC_PAGESIZE, _SC_NPROCESSORS_CONF,
and _SC_NPROCESSORS_ONLN; all other _SC_* values return EINVAL.

The flag is propagated as -DLIBC_EXPERIMENTAL_ENTRYPOINTS to both
production and test compile options, following the same pattern as
LIBC_FULL_BUILD.

Assisted-by: Automated tooling, human reviewed.
@llvmorg-github-actions
Copy link
Copy Markdown

llvmorg-github-actions Bot commented May 13, 2026

@llvm/pr-subscribers-libc

@llvm/pr-subscribers-backend-risc-v

Author: Jeff Bailey (kaladron)

Changes

Adds a new CMake option, OFF by default, to gate entrypoints with known-incomplete implementations. This lets developers build and test partially-implemented functions without exposing them to production users.

The motivating case is sysconf, which only handles three of the required _SC_* constants (_SC_PAGESIZE, _SC_NPROCESSORS_CONF, _SC_NPROCESSORS_ONLN) and returns EINVAL for everything else. Functions like this are useful to have in a build for testing progress, but shouldn't be part of a default full build until the implementation is complete.

Changes:

  • libc/CMakeLists.txt: adds option(LLVM_LIBC_ENABLE_EXPERIMENTAL_ENTRYPOINTS ... OFF)
  • libc/cmake/modules/LLVMLibCCompileOptionRules.cmake: propagates -DLIBC_EXPERIMENTAL_ENTRYPOINTS when ON
  • libc/cmake/modules/LLVMLibCTestRules.cmake: same for test compile options
  • libc/config/linux/{x86_64,aarch64,riscv}/entrypoints.txt: moves sysconf behind the new flag

The flag does not require LLVM_LIBC_FULL_BUILD since overlay builds may also have incomplete entrypoints that benefit from this gating.


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

6 Files Affected:

  • (modified) libc/CMakeLists.txt (+8)
  • (modified) libc/cmake/modules/LLVMLibCCompileOptionRules.cmake (+4)
  • (modified) libc/cmake/modules/LLVMLibCTestRules.cmake (+4)
  • (modified) libc/config/linux/aarch64/entrypoints.txt (+10-1)
  • (modified) libc/config/linux/riscv/entrypoints.txt (+10-1)
  • (modified) libc/config/linux/x86_64/entrypoints.txt (+10-1)
diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index e796598e48924..a31fb60e8d958 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -140,6 +140,14 @@ option(LLVM_LIBC_FULL_BUILD "Build and test LLVM libc as if it is the full libc"
 option(LLVM_LIBC_IMPLEMENTATION_DEFINED_TEST_BEHAVIOR "Build LLVM libc tests assuming our implementation-defined behavior" ON)
 option(LLVM_LIBC_ENABLE_LINTING "Enables linting of libc source files" OFF)
 option(LLVM_LIBC_ALL_HEADERS "Outputs all functions in header files, regardless of whether they are enabled on this target" OFF)
+# Enable entrypoints that have known-incomplete implementations but are useful
+# for testing or development purposes. These are NOT suitable for production use
+# and are disabled by default. Examples include functions that only handle a
+# subset of their specified inputs (e.g. sysconf, which only handles a few
+# _SC_* constants). Enable this flag if you need to build with these entrypoints
+# for testing or if you are actively working on their implementation.
+option(LLVM_LIBC_ENABLE_EXPERIMENTAL_ENTRYPOINTS
+  "Enable entrypoints with known-incomplete implementations (off by default)" OFF)
 
 option(LIBC_CONFIG_PATH "The path to user provided folder that configures the build for the target system." OFF)
 
diff --git a/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake b/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
index 2fae55997cabb..5bb79fc47f60f 100644
--- a/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
+++ b/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
@@ -253,6 +253,10 @@ function(_get_common_compile_options output_var flags)
       endif()
     endif()
 
+    if(LLVM_LIBC_ENABLE_EXPERIMENTAL_ENTRYPOINTS)
+      list(APPEND compile_options "-DLIBC_EXPERIMENTAL_ENTRYPOINTS")
+    endif()
+
     if(LIBC_COMPILER_HAS_FIXED_POINT)
       list(APPEND compile_options "-ffixed-point")
     endif()
diff --git a/libc/cmake/modules/LLVMLibCTestRules.cmake b/libc/cmake/modules/LLVMLibCTestRules.cmake
index 034396cba158c..ce2e8f689873a 100644
--- a/libc/cmake/modules/LLVMLibCTestRules.cmake
+++ b/libc/cmake/modules/LLVMLibCTestRules.cmake
@@ -34,6 +34,10 @@ function(_get_common_test_compile_options output_var c_test flags)
       endif()
     endif()
 
+    if(LLVM_LIBC_ENABLE_EXPERIMENTAL_ENTRYPOINTS)
+      list(APPEND compile_options "-DLIBC_EXPERIMENTAL_ENTRYPOINTS")
+    endif()
+
     if(LIBC_COMPILER_HAS_FIXED_POINT)
       list(APPEND compile_options "-ffixed-point")
     endif()
diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt
index e62bc67e2d5ca..743e761c746f6 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -387,7 +387,6 @@ set(TARGET_LIBC_ENTRYPOINTS
     libc.src.unistd.setsid
     libc.src.unistd.symlink
     libc.src.unistd.symlinkat
-    libc.src.unistd.sysconf
     libc.src.unistd.truncate
     libc.src.unistd.unlink
     libc.src.unistd.unlinkat
@@ -1265,6 +1264,16 @@ if(LLVM_LIBC_FULL_BUILD)
   )
 endif()
 
+# Entrypoints with known-incomplete implementations. Only enabled when
+# LLVM_LIBC_ENABLE_EXPERIMENTAL_ENTRYPOINTS is ON.
+if(LLVM_LIBC_ENABLE_EXPERIMENTAL_ENTRYPOINTS)
+  list(APPEND TARGET_LIBC_ENTRYPOINTS
+    # unistd.h - incomplete: only handles _SC_PAGESIZE, _SC_NPROCESSORS_CONF,
+    # and _SC_NPROCESSORS_ONLN; returns EINVAL for all other _SC_* values.
+    libc.src.unistd.sysconf
+  )
+endif()
+
 set(TARGET_LIBMVEC_ENTRYPOINTS)
 
 if(LIBC_COMPILER_HAS_EXT_VECTOR_TYPE)
diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt
index d1c52dffdb6e7..7645aded27c9a 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -390,7 +390,6 @@ set(TARGET_LIBC_ENTRYPOINTS
     libc.src.unistd.setsid
     libc.src.unistd.symlink
     libc.src.unistd.symlinkat
-    libc.src.unistd.sysconf
     libc.src.unistd.truncate
     libc.src.unistd.unlink
     libc.src.unistd.unlinkat
@@ -1399,6 +1398,16 @@ if(LLVM_LIBC_FULL_BUILD)
   )
 endif()
 
+# Entrypoints with known-incomplete implementations. Only enabled when
+# LLVM_LIBC_ENABLE_EXPERIMENTAL_ENTRYPOINTS is ON.
+if(LLVM_LIBC_ENABLE_EXPERIMENTAL_ENTRYPOINTS)
+  list(APPEND TARGET_LIBC_ENTRYPOINTS
+    # unistd.h - incomplete: only handles _SC_PAGESIZE, _SC_NPROCESSORS_CONF,
+    # and _SC_NPROCESSORS_ONLN; returns EINVAL for all other _SC_* values.
+    libc.src.unistd.sysconf
+  )
+endif()
+
 set(TARGET_LLVMLIBC_ENTRYPOINTS
   ${TARGET_LIBC_ENTRYPOINTS}
   ${TARGET_LIBM_ENTRYPOINTS}
diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index 73b4b3fcd191f..00210c9064dbe 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -408,7 +408,6 @@ set(TARGET_LIBC_ENTRYPOINTS
     libc.src.unistd.setsid
     libc.src.unistd.symlink
     libc.src.unistd.symlinkat
-    libc.src.unistd.sysconf
     libc.src.unistd.truncate
     libc.src.unistd.unlink
     libc.src.unistd.unlinkat
@@ -1489,6 +1488,16 @@ if(LLVM_LIBC_FULL_BUILD)
   )
 endif()
 
+# Entrypoints with known-incomplete implementations. Only enabled when
+# LLVM_LIBC_ENABLE_EXPERIMENTAL_ENTRYPOINTS is ON.
+if(LLVM_LIBC_ENABLE_EXPERIMENTAL_ENTRYPOINTS)
+  list(APPEND TARGET_LIBC_ENTRYPOINTS
+    # unistd.h - incomplete: only handles _SC_PAGESIZE, _SC_NPROCESSORS_CONF,
+    # and _SC_NPROCESSORS_ONLN; returns EINVAL for all other _SC_* values.
+    libc.src.unistd.sysconf
+  )
+endif()
+
 set(TARGET_LIBMVEC_ENTRYPOINTS)
 
 if(LIBC_COMPILER_HAS_EXT_VECTOR_TYPE)

@kaladron kaladron marked this pull request as draft May 13, 2026 19:34
Comment thread libc/config/linux/x86_64/entrypoints.txt Outdated
Comment thread libc/cmake/modules/LLVMLibCCompileOptionRules.cmake Outdated
…ENTRYPOINTS

Remove compile-time -DLIBC_EXPERIMENTAL_ENTRYPOINTS define from both
LLVMLibCCompileOptionRules.cmake and LLVMLibCTestRules.cmake. The flag
is purely a build-system concern; no source-level #ifdef usage exists.

Remove verbose comments from the option definition in CMakeLists.txt
and the entrypoints.txt blocks. The if() guard is self-documenting, and
per-entrypoint inline comments would quickly go stale.

Assisted-by: Automated tooling, human reviewed.
@kaladron kaladron marked this pull request as ready for review May 13, 2026 20:29
@kaladron kaladron requested a review from michaelrj-google May 13, 2026 20:29
@kaladron
Copy link
Copy Markdown
Member Author

Hi Michael! You and I had talked about doing something like this for things like sysconf and the regex patches. Can you please take a look and see if it meets what you're thinking?

@vonosmas - My apologies. I actually created the PR earlier than planned.

Copy link
Copy Markdown
Member

@michaelrj-google michaelrj-google left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, we should probably update the build instructions on the website to mention this but that can be a followup.

@kaladron kaladron merged commit 1d93fc4 into llvm:main May 14, 2026
34 checks passed
@kaladron kaladron deleted the experimental branch May 14, 2026 06:01
@llvm-ci
Copy link
Copy Markdown

llvm-ci commented May 14, 2026

LLVM Buildbot has detected a new failure on builder libc-x86_64-debian-fullbuild-dbg running on libc-x86_64-debian-fullbuild while building libc at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/179/builds/46952

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py ...' (failure)
...
-- Doxygen disabled.
-- Setting LIBC_NAMESPACE namespace to '__llvm_libc_20_0_0_git'
-- Set COMPILER_RESOURCE_DIR to /usr/lib/llvm-14/lib/clang/14.0.6 using --print-resource-dir
-- Building libc for x86_64 on linux with LIBC_COMPILE_OPTIONS_DEFAULT: 
-- LIBC_COPT_USE_C_ASSERT: OFF
-- LIBC_CONF_ENABLE_STRONG_STACK_PROTECTOR: ON
-- LIBC_CONF_KEEP_FRAME_POINTER: ON
-- LIBC_CONF_CTYPE_SMALLER_ASCII: OFF
-- LIBC_CONF_ERRNO_MODE: LIBC_ERRNO_MODE_DEFAULT
-- LIBC_CONF_TRAP_ON_RAISE_FP_EXCEPT: OFF
-- LIBC_ADD_NULL_CHECKS: ON
-- LIBC_CONF_FREXP_INF_NAN_EXPONENT: 
-- LIBC_CONF_MATH_OPTIMIZATIONS: 0
-- LIBC_CONF_MATH_USE_SYSTEM_FENV: OFF
-- LIBC_CONF_PRINTF_DISABLE_FIXED_POINT: OFF
-- LIBC_CONF_PRINTF_DISABLE_FLOAT: OFF
-- LIBC_CONF_PRINTF_DISABLE_INDEX_MODE: OFF
-- LIBC_CONF_PRINTF_DISABLE_STRERROR: OFF
-- LIBC_CONF_PRINTF_DISABLE_WIDE: OFF
-- LIBC_CONF_PRINTF_DISABLE_WRITE_INT: OFF
-- LIBC_CONF_PRINTF_FLOAT_TO_STR_NO_SPECIALIZE_LD: OFF
-- LIBC_CONF_PRINTF_FLOAT_TO_STR_USE_DYADIC_FLOAT: OFF
-- LIBC_CONF_PRINTF_FLOAT_TO_STR_USE_FLOAT320: OFF
-- LIBC_CONF_PRINTF_FLOAT_TO_STR_USE_MEGA_LONG_DOUBLE_TABLE: OFF
-- LIBC_CONF_PRINTF_MODULAR: OFF
-- LIBC_CONF_PRINTF_RUNTIME_DISPATCH: ON
-- LIBC_COPT_PRINTF_DISABLE_BITINT: OFF
-- LIBC_CONF_RAW_MUTEX_DEFAULT_SPIN_COUNT: 100
-- LIBC_CONF_RWLOCK_DEFAULT_SPIN_COUNT: 100
-- LIBC_CONF_TIMEOUT_ENSURE_MONOTONICITY: ON
-- LIBC_CONF_QSORT_IMPL: LIBC_QSORT_QUICK_SORT
-- LIBC_CONF_SCANF_DISABLE_FLOAT: OFF
-- LIBC_CONF_SCANF_DISABLE_INDEX_MODE: OFF
-- LIBC_CONF_SETJMP_AARCH64_RESTORE_PLATFORM_REGISTER: ON
-- LIBC_CONF_STRTOFLOAT_DISABLE_CLINGER_FAST_PATH: OFF
-- LIBC_CONF_STRTOFLOAT_DISABLE_EISEL_LEMIRE: OFF
-- LIBC_CONF_STRTOFLOAT_DISABLE_SIMPLE_DECIMAL_CONVERSION: OFF
-- LIBC_CONF_COPT_MEMCPY_X86_USE_NTA_STORES: OFF
-- LIBC_CONF_FIND_FIRST_CHARACTER_IMPL: element
-- LIBC_CONF_MEMSET_X86_USE_SOFTWARE_PREFETCHING: OFF
-- LIBC_CONF_STRING_LENGTH_IMPL: element
-- LIBC_CONF_THREAD_MODE: LIBC_THREAD_MODE_PLATFORM
-- LIBC_CONF_TIME_64BIT: OFF
-- LIBC_CONF_WCTYPE_MODE: LIBC_WCTYPE_MODE_ASCII
-- Writing config doc to /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/build/libc/docs/configure.rst
-- Overriding - LIBC_CONF_FIND_FIRST_CHARACTER_IMPL: word (Previous value: element)
-- Overriding - LIBC_CONF_STRING_LENGTH_IMPL: clang_vector (Previous value: element)
-- Set CPU features: AVX;AVX2;FMA;SSE2;SSE4_2
-- Compiler features available: builtin_fmax_fmin;builtin_isnan;cfloat128;float128
-- Using getrandom for hashtable randomness
Step 5 (cmake) failure: cmake (failure)
...
CMake Error at /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/cmake/modules/LLVMLibCLibraryRules.cmake:151 (add_library):
  Error evaluating generator expression:

    $<TARGET_OBJECTS:libc.src.unistd.sysconf>

  Objects of target "libc.src.unistd.sysconf" referenced but is not one of
  the allowed target types (EXECUTABLE, STATIC, SHARED, MODULE, OBJECT).
Call Stack (most recent call first):
  /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/test/integration/scudo/CMakeLists.txt:13 (add_entrypoint_library)
CMake Error at /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/cmake/modules/LLVMLibCLibraryRules.cmake:151 (add_library):
  Error evaluating generator expression:

    $<TARGET_OBJECTS:libc.src.unistd.sysconf>

  Objects of target "libc.src.unistd.sysconf" referenced but is not one of
  the allowed target types (EXECUTABLE, STATIC, SHARED, MODULE, OBJECT).
Call Stack (most recent call first):
  /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/test/integration/scudo/CMakeLists.txt:13 (add_entrypoint_library)


CMake Error at /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/cmake/modules/LLVMLibCLibraryRules.cmake:151 (add_library):
  Error evaluating generator expression:

    $<TARGET_OBJECTS:libc.src.unistd.sysconf>

  Objects of target "libc.src.unistd.sysconf" referenced but is not one of
  the allowed target types (EXECUTABLE, STATIC, SHARED, MODULE, OBJECT).
Call Stack (most recent call first):
  /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/test/integration/scudo/CMakeLists.txt:13 (add_entrypoint_library)
CMake Error at /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/cmake/modules/LLVMLibCLibraryRules.cmake:151 (add_library):
  No SOURCES given to target: libc_for_scudo_integration_test
Call Stack (most recent call first):
  /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/test/integration/scudo/CMakeLists.txt:13 (add_entrypoint_library)


CMake Generate step failed.  Build files cannot be regenerated correctly.
['cmake', '../llvm-project/runtimes', '-GNinja', '-DCMAKE_C_COMPILER=clang', '-DCMAKE_CXX_COMPILER=clang++', '-DCMAKE_BUILD_TYPE=Debug', '-DLLVM_ENABLE_RUNTIMES=libc;compiler-rt', '-DLLVM_LIBC_INCLUDE_SCUDO=ON', '-DCOMPILER_RT_BUILD_SCUDO_STANDALONE_WITH_LLVM_LIBC=ON', '-DCOMPILER_RT_BUILD_GWP_ASAN=OFF', '-DCOMPILER_RT_SCUDO_STANDALONE_BUILD_SHARED=OFF', '-DLLVM_LIBC_FULL_BUILD=ON'] exited with return code 1.
The build step threw an exception...
Traceback (most recent call last):
  File "/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 181, in step
    yield
  File "/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 135, in main
    run_command(['cmake', os.path.join(source_dir, cmake_root)] + cmake_args)
  File "/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 196, in run_command
    util.report_run_cmd(cmd, cwd=directory)
  File "/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-zorg/zorg/buildbot/builders/annotated/util.py", line 49, in report_run_cmd
    subprocess.check_call(cmd, shell=shell, *args, **kwargs)
  File "/usr/lib/python3.11/subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '../llvm-project/runtimes', '-GNinja', '-DCMAKE_C_COMPILER=clang', '-DCMAKE_CXX_COMPILER=clang++', '-DCMAKE_BUILD_TYPE=Debug', '-DLLVM_ENABLE_RUNTIMES=libc;compiler-rt', '-DLLVM_LIBC_INCLUDE_SCUDO=ON', '-DCOMPILER_RT_BUILD_SCUDO_STANDALONE_WITH_LLVM_LIBC=ON', '-DCOMPILER_RT_BUILD_GWP_ASAN=OFF', '-DCOMPILER_RT_SCUDO_STANDALONE_BUILD_SHARED=OFF', '-DLLVM_LIBC_FULL_BUILD=ON']' returned non-zero exit status 1.

EuphoricThinking pushed a commit to EuphoricThinking/llvm-project that referenced this pull request May 14, 2026
…#197537)

Adds a new CMake option, OFF by default, to gate entrypoints with
known-incomplete implementations. This lets developers build and test
partially-implemented functions without exposing them to production
users.

The motivating case is `sysconf`, which only handles three of the
required `_SC_*` constants (`_SC_PAGESIZE`, `_SC_NPROCESSORS_CONF`,
`_SC_NPROCESSORS_ONLN`) and returns `EINVAL` for everything else.
Functions like this are useful to have in a build for testing progress,
but shouldn't be part of a default full build until the implementation
is complete.

Changes:
- `libc/CMakeLists.txt`: adds
`option(LLVM_LIBC_ENABLE_EXPERIMENTAL_ENTRYPOINTS ... OFF)`
- `libc/cmake/modules/LLVMLibCCompileOptionRules.cmake`: propagates
`-DLIBC_EXPERIMENTAL_ENTRYPOINTS` when ON
- `libc/cmake/modules/LLVMLibCTestRules.cmake`: same for test compile
options
- `libc/config/linux/{x86_64,aarch64,riscv}/entrypoints.txt`: moves
`sysconf` behind the new flag

The flag does not require `LLVM_LIBC_FULL_BUILD` since overlay builds
may also have incomplete entrypoints that benefit from this gating.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants