[PATCH] [CMake] Introduce LLVM_DEAD_STRIP instead of LLVM_NO_DEAD_STRIP
NAKAMURA Takumi
geek4civic at gmail.com
Tue Mar 4 16:07:44 PST 2014
I missed the stuff in autoconf.
It'd be hard to introduce non-negative DEAD_STRIP in autoconf. I'll
abandon this.
2014-03-05 6:28 GMT+09:00 Chandler Carruth <chandlerc at gmail.com>:
> On Tue, Mar 4, 2014 at 1:26 PM, Nico Weber <thakis at chromium.org> wrote:
>>
>> Do you want to change llvm/Makefile.rules too? (I picked the current name
>> to be consistent with the Makefile. I agree not having a double negative is
>> nice, but having the same name in cmake and make is nicer, imho.)
>
>
> I agree with all of this. =]
>>
>>
>>
>> On Tue, Mar 4, 2014 at 7:48 AM, NAKAMURA Takumi <geek4civic at gmail.com>
>> wrote:
>>>
>>> Hi chandlerc,
>>>
>>> I think "LLVM_NO_DEAD_STRIP" would confuse like a double negative.
>>> I propose "LLVM_DEAD_STRIP", ON if available. Each executable can turn it
>>> OFF.
>>>
>>> http://llvm-reviews.chandlerc.com/D2941
>>>
>>> Files:
>>> clang/tools/driver/CMakeLists.txt
>>> llvm/cmake/modules/AddLLVM.cmake
>>> llvm/cmake/modules/HandleLLVMOptions.cmake
>>> llvm/tools/bugpoint/CMakeLists.txt
>>> llvm/tools/llc/CMakeLists.txt
>>> llvm/tools/opt/CMakeLists.txt
>>> llvm/unittests/ExecutionEngine/JIT/CMakeLists.txt
>>>
>>> Index: clang/tools/driver/CMakeLists.txt
>>> ===================================================================
>>> --- clang/tools/driver/CMakeLists.txt
>>> +++ clang/tools/driver/CMakeLists.txt
>>> @@ -17,7 +17,7 @@
>>> )
>>>
>>> # Support plugins.
>>> -set(LLVM_NO_DEAD_STRIP 1)
>>> +set(LLVM_DEAD_STRIP OFF)
>>>
>>> add_clang_executable(clang
>>> driver.cpp
>>> Index: llvm/cmake/modules/AddLLVM.cmake
>>> ===================================================================
>>> --- llvm/cmake/modules/AddLLVM.cmake
>>> +++ llvm/cmake/modules/AddLLVM.cmake
>>> @@ -134,17 +134,19 @@
>>> endfunction(add_llvm_symbol_exports)
>>>
>>> function(add_dead_strip target_name)
>>> - if(NOT LLVM_NO_DEAD_STRIP)
>>> - if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
>>> - set_property(TARGET ${target_name} APPEND_STRING PROPERTY
>>> - LINK_FLAGS " -Wl,-dead_strip")
>>> - elseif(NOT WIN32)
>>> - # Object files are compiled with -ffunction-data-sections.
>>> - set_property(TARGET ${target_name} APPEND_STRING PROPERTY
>>> - LINK_FLAGS " -Wl,--gc-sections")
>>> - endif()
>>> + if(NOT LLVM_DEAD_STRIP)
>>> + return()
>>> endif()
>>> -endfunction(add_dead_strip)
>>> +
>>> + if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
>>> + set_property(TARGET ${target_name} APPEND_STRING PROPERTY
>>> + LINK_FLAGS " -Wl,-dead_strip")
>>> + elseif(NOT WIN32)
>>> + # Object files are compiled with -ffunction-data-sections.
>>> + set_property(TARGET ${target_name} APPEND_STRING PROPERTY
>>> + LINK_FLAGS " -Wl,--gc-sections")
>>> + endif()
>>> +endfunction()
>>>
>>> # Set each output directory according to ${CMAKE_CONFIGURATION_TYPES}.
>>> # Note: Don't set variables CMAKE_*_OUTPUT_DIRECTORY any more,
>>> Index: llvm/cmake/modules/HandleLLVMOptions.cmake
>>> ===================================================================
>>> --- llvm/cmake/modules/HandleLLVMOptions.cmake
>>> +++ llvm/cmake/modules/HandleLLVMOptions.cmake
>>> @@ -353,8 +353,9 @@
>>> # 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.
>>> +# flags instead if LLVM_DEAD_STRIP is not set.
>>> if(NOT CYGWIN AND NOT WIN32)
>>> + set(LLVM_DEAD_STRIP ON)
>>> if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
>>> check_c_compiler_flag("-Werror -fno-function-sections"
>>> C_SUPPORTS_FNO_FUNCTION_SECTIONS)
>>> if (C_SUPPORTS_FNO_FUNCTION_SECTIONS)
>>> Index: llvm/tools/bugpoint/CMakeLists.txt
>>> ===================================================================
>>> --- llvm/tools/bugpoint/CMakeLists.txt
>>> +++ llvm/tools/bugpoint/CMakeLists.txt
>>> @@ -18,7 +18,7 @@
>>> )
>>>
>>> # Support plugins.
>>> -set(LLVM_NO_DEAD_STRIP 1)
>>> +set(LLVM_DEAD_STRIP OFF)
>>>
>>> add_llvm_tool(bugpoint
>>> BugDriver.cpp
>>> Index: llvm/tools/llc/CMakeLists.txt
>>> ===================================================================
>>> --- llvm/tools/llc/CMakeLists.txt
>>> +++ llvm/tools/llc/CMakeLists.txt
>>> @@ -12,7 +12,7 @@
>>> )
>>>
>>> # Support plugins.
>>> -set(LLVM_NO_DEAD_STRIP 1)
>>> +set(LLVM_DEAD_STRIP OFF)
>>>
>>> add_llvm_tool(llc
>>> llc.cpp
>>> Index: llvm/tools/opt/CMakeLists.txt
>>> ===================================================================
>>> --- llvm/tools/opt/CMakeLists.txt
>>> +++ llvm/tools/opt/CMakeLists.txt
>>> @@ -19,7 +19,7 @@
>>> )
>>>
>>> # Support plugins.
>>> -set(LLVM_NO_DEAD_STRIP 1)
>>> +set(LLVM_DEAD_STRIP OFF)
>>>
>>> add_llvm_tool(opt
>>> AnalysisWrappers.cpp
>>> Index: llvm/unittests/ExecutionEngine/JIT/CMakeLists.txt
>>> ===================================================================
>>> --- llvm/unittests/ExecutionEngine/JIT/CMakeLists.txt
>>> +++ llvm/unittests/ExecutionEngine/JIT/CMakeLists.txt
>>> @@ -52,7 +52,7 @@
>>> endif()
>>>
>>> # The JIT tests need to dlopen things.
>>> -set(LLVM_NO_DEAD_STRIP 1)
>>> +set(LLVM_DEAD_STRIP OFF)
>>>
>>> add_llvm_unittest(JITTests
>>> ${JITTestsSources}
>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
More information about the llvm-commits
mailing list