[libc-commits] [libc] 2f28378 - [libc] Fix builds on Windows (#102162)
via libc-commits
libc-commits at lists.llvm.org
Tue Aug 6 08:38:09 PDT 2024
Author: Sirui Mu
Date: 2024-08-06T08:38:05-07:00
New Revision: 2f28378317827afed81db1c2ce33c187ee6582a0
URL: https://github.com/llvm/llvm-project/commit/2f28378317827afed81db1c2ce33c187ee6582a0
DIFF: https://github.com/llvm/llvm-project/commit/2f28378317827afed81db1c2ce33c187ee6582a0.diff
LOG: [libc] Fix builds on Windows (#102162)
This PR changes several places in the CMake scripts to make libc build
on Windows. It adds the `errno` entrypoint to the Windows target.
A mistake in the overlay build doc is also fixed.
Tests still cannot be built on Windows because of the lack of osutils.
Added:
Modified:
libc/cmake/modules/LLVMLibCTestRules.cmake
libc/config/windows/entrypoints.txt
libc/docs/overlay_mode.rst
Removed:
################################################################################
diff --git a/libc/cmake/modules/LLVMLibCTestRules.cmake b/libc/cmake/modules/LLVMLibCTestRules.cmake
index 539ed0429549f6..d8097855d16377 100644
--- a/libc/cmake/modules/LLVMLibCTestRules.cmake
+++ b/libc/cmake/modules/LLVMLibCTestRules.cmake
@@ -348,7 +348,7 @@ function(add_libc_fuzzer target_name)
endfunction(add_libc_fuzzer)
# Get libgcc_s to be used in hermetic and integration tests.
-if(NOT LIBC_CC_SUPPORTS_NOSTDLIBPP)
+if(NOT MSVC AND NOT LIBC_CC_SUPPORTS_NOSTDLIBPP)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -print-file-name=libgcc_s.so.1
OUTPUT_VARIABLE LIBGCC_S_LOCATION)
string(STRIP ${LIBGCC_S_LOCATION} LIBGCC_S_LOCATION)
diff --git a/libc/config/windows/entrypoints.txt b/libc/config/windows/entrypoints.txt
index d66e7f1fed81fb..f66438061ef4ba 100644
--- a/libc/config/windows/entrypoints.txt
+++ b/libc/config/windows/entrypoints.txt
@@ -92,6 +92,9 @@ set(TARGET_LIBC_ENTRYPOINTS
libc.src.stdlib.realloc
libc.src.stdlib.aligned_alloc
libc.src.stdlib.free
+
+ # errno.h entrypoints
+ libc.src.errno.errno
)
set(TARGET_LIBM_ENTRYPOINTS
diff --git a/libc/docs/overlay_mode.rst b/libc/docs/overlay_mode.rst
index f9b566658bb49d..37368ffc1fea15 100644
--- a/libc/docs/overlay_mode.rst
+++ b/libc/docs/overlay_mode.rst
@@ -39,7 +39,7 @@ the CMake configure step as follows:
$> cd llvm-project # The llvm-project checkout
$> mkdir build
$> cd build
- $> cmake ../llvm -G Ninja -DLLVM_ENABLE_PROJECTS="libc" \
+ $> cmake ../llvm -G Ninja -DLLVM_ENABLE_RUNTIMES="libc" \
-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_BUILD_TYPE=<Debug|Release> \ # Select build type
-DCMAKE_INSTALL_PREFIX=<Your prefix of choice> # Optional
More information about the libc-commits
mailing list