Skip to content

Commit 5e3ec41

Browse files
committed
[libc] Only add -ffreestanding flag in full build mode.
Only add -ffreestanding flag in full build mode. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D158652
1 parent 3f98cdc commit 5e3ec41

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

libc/cmake/modules/LLVMLibCObjectRules.cmake

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ function(_get_common_compile_options output_var flags)
2121
set(compile_options ${LIBC_COMPILE_OPTIONS_DEFAULT} ${ARGN})
2222
if(LLVM_COMPILER_IS_GCC_COMPATIBLE)
2323
list(APPEND compile_options "-fpie")
24-
list(APPEND compile_options "-ffreestanding")
24+
25+
if(LLVM_LIBC_FULL_BUILD)
26+
# Only add -ffreestanding flag in full build mode.
27+
list(APPEND compile_options "-ffreestanding")
28+
endif()
29+
2530
list(APPEND compile_options "-fno-builtin")
2631
list(APPEND compile_options "-fno-exceptions")
2732
list(APPEND compile_options "-fno-lax-vector-conversions")

libc/cmake/modules/LLVMLibCTestRules.cmake

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,14 @@ function(create_libc_unittest fq_target_name)
156156
)
157157
target_compile_options(
158158
${fq_build_target_name}
159-
PRIVATE -fpie -ffreestanding ${LIBC_COMPILE_OPTIONS_DEFAULT}
159+
PRIVATE -fpie ${LIBC_COMPILE_OPTIONS_DEFAULT}
160160
)
161+
if(LLVM_LIBC_FULL_BUILD)
162+
target_compile_options(
163+
${fq_build_target_name}
164+
PRIVATE -ffreestanding
165+
)
166+
endif()
161167
if(LIBC_UNITTEST_COMPILE_OPTIONS)
162168
target_compile_options(
163169
${fq_build_target_name}

0 commit comments

Comments
 (0)