[libc-commits] [libc] 6632b25 - [libc] Make add_libc_unittest compile with -ffreestanding

Guillaume Chatelet via libc-commits libc-commits at lists.llvm.org
Wed Aug 9 00:32:06 PDT 2023


Author: Guillaume Chatelet
Date: 2023-08-09T07:31:59Z
New Revision: 6632b2584159ef0668a9a84dde6907b3d6f8e701

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

LOG: [libc] Make add_libc_unittest compile with -ffreestanding

tests not compile with `-ffreestanding` can pull unwanted dependencies like `limits.h` which defines `PTHREAD_STACK_MIN`.
This is what caused the build bot failure in https://reviews.llvm.org/D156981#4570776.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D157444

Added: 
    

Modified: 
    libc/cmake/modules/LLVMLibCTestRules.cmake

Removed: 
    


################################################################################
diff  --git a/libc/cmake/modules/LLVMLibCTestRules.cmake b/libc/cmake/modules/LLVMLibCTestRules.cmake
index 3f180479682d14..59c2ac99c7b66f 100644
--- a/libc/cmake/modules/LLVMLibCTestRules.cmake
+++ b/libc/cmake/modules/LLVMLibCTestRules.cmake
@@ -152,7 +152,7 @@ function(create_libc_unittest fq_target_name)
   )
   target_compile_options(
     ${fq_build_target_name}
-    PRIVATE -fpie ${LIBC_COMPILE_OPTIONS_DEFAULT}
+    PRIVATE -fpie -ffreestanding ${LIBC_COMPILE_OPTIONS_DEFAULT}
   )
   if(LIBC_UNITTEST_COMPILE_OPTIONS)
     target_compile_options(


        


More information about the libc-commits mailing list