[libcxx-commits] [compiler-rt] [libc] [libcxx] [llvm] [libc] Add a dynamic loader and dlopen for x86_64 (draft, for discussion) (PR #236698)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Oct 29 02:10:10 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {cmake-format}-->


:warning: CMake code formatter, cmake-format found issues in your code. :warning:

<details>
<summary>
You can fix this locally with the following command:
</summary>

``````````bash
python3 libc/utils/cmake_format.py -i libc/loader/CMakeLists.txt libc/loader/linux/CMakeLists.txt libc/src/__support/elf/CMakeLists.txt libc/src/tls/CMakeLists.txt libc/test/src/__support/elf/CMakeLists.txt libc/CMakeLists.txt libc/cmake/modules/CheckCompilerFeatures.cmake libc/cmake/modules/LLVMLibCCompileOptionRules.cmake libc/cmake/modules/LLVMLibCLibraryRules.cmake libc/cmake/modules/LLVMLibCObjectRules.cmake libc/include/CMakeLists.txt libc/lib/CMakeLists.txt libc/src/CMakeLists.txt libc/src/__support/CMakeLists.txt libc/src/__support/OSUtil/linux/syscall_wrappers/CMakeLists.txt libc/src/__support/fixed_point/CMakeLists.txt libc/src/__support/threads/linux/CMakeLists.txt libc/src/__support/threads/linux/aarch64/CMakeLists.txt libc/src/__support/threads/linux/riscv/CMakeLists.txt libc/src/__support/threads/linux/x86_64/CMakeLists.txt libc/src/dlfcn/CMakeLists.txt libc/src/link/CMakeLists.txt libc/startup/linux/CMakeLists.txt libc/test/src/__support/CMakeLists.txt libc/test/src/math/performance_testing/CMakeLists.txt
``````````

You can also preview the formatting diff without modifying files:

``````````bash
python3 libc/utils/cmake_format.py --dry-run --diff libc/loader/CMakeLists.txt libc/loader/linux/CMakeLists.txt libc/src/__support/elf/CMakeLists.txt libc/src/tls/CMakeLists.txt libc/test/src/__support/elf/CMakeLists.txt libc/CMakeLists.txt libc/cmake/modules/CheckCompilerFeatures.cmake libc/cmake/modules/LLVMLibCCompileOptionRules.cmake libc/cmake/modules/LLVMLibCLibraryRules.cmake libc/cmake/modules/LLVMLibCObjectRules.cmake libc/include/CMakeLists.txt libc/lib/CMakeLists.txt libc/src/CMakeLists.txt libc/src/__support/CMakeLists.txt libc/src/__support/OSUtil/linux/syscall_wrappers/CMakeLists.txt libc/src/__support/fixed_point/CMakeLists.txt libc/src/__support/threads/linux/CMakeLists.txt libc/src/__support/threads/linux/aarch64/CMakeLists.txt libc/src/__support/threads/linux/riscv/CMakeLists.txt libc/src/__support/threads/linux/x86_64/CMakeLists.txt libc/src/dlfcn/CMakeLists.txt libc/src/link/CMakeLists.txt libc/startup/linux/CMakeLists.txt libc/test/src/__support/CMakeLists.txt libc/test/src/math/performance_testing/CMakeLists.txt
``````````

</details>

<details>
<summary>
View the diff from cmake-format here.
</summary>

``````````diff
--- a/libc/src/__support/elf/CMakeLists.txt
+++ b/libc/src/__support/elf/CMakeLists.txt
@@ -296,4 +296,3 @@
     libc.src.__support.macros.attributes
     libc.src.__support.macros.config
 )
-
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -619,7 +619,7 @@
   # The startup system can potentially depend on the library components so add
   # it after the library implementation directories.
   add_subdirectory(startup)
-add_subdirectory(loader)
+  add_subdirectory(loader)
 endif()
 
 # The lib and test directories are added at the very end as tests
--- a/libc/cmake/modules/LLVMLibCLibraryRules.cmake
+++ b/libc/cmake/modules/LLVMLibCLibraryRules.cmake
@@ -36,8 +36,8 @@
     # So, we just accumulate the direct dep and return.
     set(all_deps ${deps})
   elseif((${target_type} STREQUAL ${OBJECT_LIBRARY_TARGET_TYPE}) OR
-         (${target_type} STREQUAL ${ENTRYPOINT_OBJ_TARGET_TYPE}) OR
-         (${target_type} STREQUAL ${HDR_LIBRARY_TARGET_TYPE}))
+      (${target_type} STREQUAL ${ENTRYPOINT_OBJ_TARGET_TYPE}) OR
+      (${target_type} STREQUAL ${HDR_LIBRARY_TARGET_TYPE}))
     if(${target_type} STREQUAL ${OBJECT_LIBRARY_TARGET_TYPE})
       list(APPEND all_deps ${target})
     endif()
--- a/libc/lib/CMakeLists.txt
+++ b/libc/lib/CMakeLists.txt
@@ -63,7 +63,7 @@
   # into libc, so the archive needs it too or a static link is left with the
   # weak declaration resolving to nothing.
   if(LIBC_ENABLE_SHARED AND archive_1 STREQUAL "libc"
-     AND TARGET libc.startup.${LIBC_TARGET_OS}.app)
+    AND TARGET libc.startup.${LIBC_TARGET_OS}.app)
     target_sources(${archive_1} PRIVATE
       $<TARGET_OBJECTS:libc.startup.${LIBC_TARGET_OS}.app>
       $<TARGET_OBJECTS:libc.startup.${LIBC_TARGET_OS}.passive_abi>)

``````````

</details>


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


More information about the libcxx-commits mailing list