This is an archive of the discontinued LLVM Phabricator instance.

[libc] Only add -ffreestanding flag in full build mode.
ClosedPublic

Authored by lntue on Aug 23 2023, 11:38 AM.

Details

Summary

Only add -ffreestanding flag in full build mode.

Diff Detail

Event Timeline

lntue created this revision.Aug 23 2023, 11:38 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptAug 23 2023, 11:38 AM
lntue requested review of this revision.Aug 23 2023, 11:38 AM
lntue updated this revision to Diff 552861.Aug 23 2023, 1:07 PM

Only add -ffreestanding to unit tests in full build mode.

sivachandra accepted this revision.Aug 23 2023, 1:13 PM
sivachandra added inline comments.
libc/cmake/modules/LLVMLibCTestRules.cmake
170

A cleaner approach is likely:

target_compile_options(
  ${fq_build_target_name}
  PRIVATE -fpie ${LIBC_COMPILE_OPTIONS_DEFAULT})
)
if(LLVM_LIBC_FULL_BUILD)
  target_compile_options(${fq_build_target_name} PRIVATE -ffreestanding)
endif()
This revision is now accepted and ready to land.Aug 23 2023, 1:13 PM
lntue updated this revision to Diff 552867.Aug 23 2023, 1:32 PM

Address comment.

This revision was automatically updated to reflect the committed changes.
lntue marked an inline comment as done.