[CMake] Move -ffunction-data-sections stuff to HandleLLVMOptions.

With this tweaks, also unittests are compiled with -ffunction-sections.

It's hard to control contextual CMAKE_CXX_FLAGS. We should get rid of twiddling it as possible.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200299 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
NAKAMURA Takumi
2014-01-28 09:43:55 +00:00
parent 286d7d8312
commit 4fc67f0491
2 changed files with 11 additions and 10 deletions

View File

@@ -349,3 +349,13 @@ if (UNIX AND
CMAKE_GENERATOR STREQUAL "Ninja")
append("-fcolor-diagnostics" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
endif()
# Add flags for add_dead_strip().
# FIXME: With MSVS, consider compiling with /Gy and linking with /OPT:REF?
# But MinSizeRel seems to add that automatically, so maybe disable these
# flags instead if LLVM_NO_DEAD_STRIP is set.
if(NOT CYGWIN AND NOT WIN32)
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
append("-ffunction-sections -fdata-sections" CMAKE_CXX_FLAGS)
endif()
endif()