[libc-commits] [PATCH] D158652: [libc] Only add -ffreestanding flag in full build mode.

Tue Ly via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Aug 24 07:16:12 PDT 2023


This revision was automatically updated to reflect the committed changes.
lntue marked an inline comment as done.
Closed by commit rG5e3ec418ff3b: [libc] Only add -ffreestanding flag in full build mode. (authored by lntue).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158652/new/

https://reviews.llvm.org/D158652

Files:
  libc/cmake/modules/LLVMLibCObjectRules.cmake
  libc/cmake/modules/LLVMLibCTestRules.cmake


Index: libc/cmake/modules/LLVMLibCTestRules.cmake
===================================================================
--- libc/cmake/modules/LLVMLibCTestRules.cmake
+++ libc/cmake/modules/LLVMLibCTestRules.cmake
@@ -156,8 +156,14 @@
   )
   target_compile_options(
     ${fq_build_target_name}
-    PRIVATE -fpie -ffreestanding ${LIBC_COMPILE_OPTIONS_DEFAULT}
+    PRIVATE -fpie ${LIBC_COMPILE_OPTIONS_DEFAULT}
   )
+  if(LLVM_LIBC_FULL_BUILD)
+    target_compile_options(
+      ${fq_build_target_name}
+      PRIVATE -ffreestanding
+    )
+  endif()
   if(LIBC_UNITTEST_COMPILE_OPTIONS)
     target_compile_options(
       ${fq_build_target_name}
Index: libc/cmake/modules/LLVMLibCObjectRules.cmake
===================================================================
--- libc/cmake/modules/LLVMLibCObjectRules.cmake
+++ libc/cmake/modules/LLVMLibCObjectRules.cmake
@@ -21,7 +21,12 @@
   set(compile_options ${LIBC_COMPILE_OPTIONS_DEFAULT} ${ARGN})
   if(LLVM_COMPILER_IS_GCC_COMPATIBLE)
     list(APPEND compile_options "-fpie")
-    list(APPEND compile_options "-ffreestanding")
+
+    if(LLVM_LIBC_FULL_BUILD)
+      # Only add -ffreestanding flag in full build mode.
+      list(APPEND compile_options "-ffreestanding")
+    endif()
+
     list(APPEND compile_options "-fno-builtin")
     list(APPEND compile_options "-fno-exceptions")
     list(APPEND compile_options "-fno-lax-vector-conversions")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158652.553118.patch
Type: text/x-patch
Size: 1405 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230824/5dec0118/attachment.bin>


More information about the libc-commits mailing list