[libc-commits] [libc] d2e0a98 - [libc][NFC] Compile tests also with -fpie.

Siva Chandra Reddy via libc-commits libc-commits at lists.llvm.org
Wed Mar 8 23:45:49 PST 2023


Author: Siva Chandra Reddy
Date: 2023-03-09T07:45:39Z
New Revision: d2e0a98391e3657a679b98475d65954622c44a9e

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

LOG: [libc][NFC] Compile tests also with -fpie.

The libc runtime code is already compiled with -fpie.

Added: 
    

Modified: 
    libc/cmake/modules/LLVMLibCTestRules.cmake

Removed: 
    


################################################################################
diff  --git a/libc/cmake/modules/LLVMLibCTestRules.cmake b/libc/cmake/modules/LLVMLibCTestRules.cmake
index 3dafa4eb7a403..e4cc562dd1082 100644
--- a/libc/cmake/modules/LLVMLibCTestRules.cmake
+++ b/libc/cmake/modules/LLVMLibCTestRules.cmake
@@ -150,7 +150,7 @@ function(create_libc_unittest fq_target_name)
   )
   target_compile_options(
     ${fq_build_target_name}
-    PRIVATE ${LIBC_COMPILE_OPTIONS_DEFAULT}
+    PRIVATE -fpie ${LIBC_COMPILE_OPTIONS_DEFAULT}
   )
   if(LIBC_UNITTEST_COMPILE_OPTIONS)
     target_compile_options(
@@ -512,7 +512,7 @@ function(add_integration_test test_name)
       ${LIBC_BUILD_DIR}/include
   )
   target_compile_options(${fq_build_target_name}
-                         PRIVATE -ffreestanding ${INTEGRATION_TEST_COMPILE_OPTIONS})
+                         PRIVATE -fpie -ffreestanding ${INTEGRATION_TEST_COMPILE_OPTIONS})
   target_link_options(${fq_build_target_name} PRIVATE -nostdlib -static)
   target_link_libraries(${fq_build_target_name}
                         ${INTEGRATION_TEST_STARTUP} ${fq_target_name}.__libc__


        


More information about the libc-commits mailing list