[llvm] r198198 - Port r198087 and r198089 (strip dead code by default) from make to cmake.

NAKAMURA Takumi geek4civic at gmail.com
Sun Dec 29 21:39:47 PST 2013


It is less harmful and I will fix soon.

-  if(NOT CYGWIN AND NOT MINGW)
+  if(NOT CYGWIN AND NOT WIN32)

2013/12/30 Yaron Keren <yaron.keren at gmail.com>:
> Hi Nico,
>
> MSVC does not support the -f* flags, so I fixed the add_dead_strip function
> to be:
>
> function(add_dead_strip target_name)
>   if(NOT CYGWIN AND NOT MINGW AND NOT MSVC)
>     if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
>
> Yaron
>
>
>
> 2013/12/30 Nico Weber <nicolasweber at gmx.de>
>>
>> Author: nico
>> Date: Sun Dec 29 21:36:05 2013
>> New Revision: 198198
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=198198&view=rev
>> Log:
>> Port r198087 and r198089 (strip dead code by default) from make to cmake.
>>
>> Modified:
>>     llvm/trunk/cmake/modules/AddLLVM.cmake
>>     llvm/trunk/tools/bugpoint/CMakeLists.txt
>>     llvm/trunk/tools/llc/CMakeLists.txt
>>     llvm/trunk/tools/opt/CMakeLists.txt
>>     llvm/trunk/unittests/ExecutionEngine/JIT/CMakeLists.txt
>>
>> Modified: llvm/trunk/cmake/modules/AddLLVM.cmake
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddLLVM.cmake?rev=198198&r1=198197&r2=198198&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/cmake/modules/AddLLVM.cmake (original)
>> +++ llvm/trunk/cmake/modules/AddLLVM.cmake Sun Dec 29 21:36:05 2013
>> @@ -76,10 +76,30 @@ function(add_llvm_symbol_exports target_
>>    add_dependencies(${target_name} ${target_name}_exports)
>>  endfunction(add_llvm_symbol_exports)
>>
>> +function(add_dead_strip target_name)
>> +  if(NOT CYGWIN AND NOT MINGW)
>> +    if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
>> +       SET(CMAKE_CXX_FLAGS
>> +           "${CMAKE_CXX_FLAGS}  -ffunction-sections -fdata-sections"
>> +           PARENT_SCOPE)
>> +    endif()
>> +  endif()
>> +  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)
>> +      set_property(TARGET ${target_name} APPEND_STRING PROPERTY
>> +                   LINK_FLAGS " -Wl,--gc-sections")
>> +    endif()
>> +  endif()
>> +endfunction(add_dead_strip)
>> +
>>  macro(add_llvm_library name)
>>    llvm_process_sources( ALL_FILES ${ARGN} )
>>    add_library( ${name} ${ALL_FILES} )
>>    set_property( GLOBAL APPEND PROPERTY LLVM_LIBS ${name} )
>> +  add_dead_strip( ${name} )
>>    if( LLVM_COMMON_DEPENDS )
>>      add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} )
>>    endif( LLVM_COMMON_DEPENDS )
>> @@ -137,6 +157,7 @@ ${name} ignored.")
>>
>>      add_library( ${name} ${libkind} ${ALL_FILES} )
>>      set_target_properties( ${name} PROPERTIES PREFIX "" )
>> +    add_dead_strip( ${name} )
>>
>>      if (LLVM_EXPORTED_SYMBOL_FILE)
>>        add_llvm_symbol_exports( ${name} ${LLVM_EXPORTED_SYMBOL_FILE} )
>> @@ -173,6 +194,7 @@ macro(add_llvm_executable name)
>>    else()
>>      add_executable(${name} ${ALL_FILES})
>>    endif()
>> +  add_dead_strip( ${name} )
>>
>>    if (LLVM_EXPORTED_SYMBOL_FILE)
>>      add_llvm_symbol_exports( ${name} ${LLVM_EXPORTED_SYMBOL_FILE} )
>>
>> Modified: llvm/trunk/tools/bugpoint/CMakeLists.txt
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/CMakeLists.txt?rev=198198&r1=198197&r2=198198&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/tools/bugpoint/CMakeLists.txt (original)
>> +++ llvm/trunk/tools/bugpoint/CMakeLists.txt Sun Dec 29 21:36:05 2013
>> @@ -16,6 +16,9 @@ set(LLVM_LINK_COMPONENTS
>>    Vectorize
>>    )
>>
>> +# Support plugins.
>> +set(LLVM_NO_DEAD_STRIP 1)
>> +
>>  add_llvm_tool(bugpoint
>>    BugDriver.cpp
>>    CrashDebugger.cpp
>>
>> Modified: llvm/trunk/tools/llc/CMakeLists.txt
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llc/CMakeLists.txt?rev=198198&r1=198197&r2=198198&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/tools/llc/CMakeLists.txt (original)
>> +++ llvm/trunk/tools/llc/CMakeLists.txt Sun Dec 29 21:36:05 2013
>> @@ -11,6 +11,9 @@ set(LLVM_LINK_COMPONENTS
>>    Target
>>    )
>>
>> +# Support plugins.
>> +set(LLVM_NO_DEAD_STRIP 1)
>> +
>>  add_llvm_tool(llc
>>    llc.cpp
>>    )
>>
>> Modified: llvm/trunk/tools/opt/CMakeLists.txt
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/CMakeLists.txt?rev=198198&r1=198197&r2=198198&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/tools/opt/CMakeLists.txt (original)
>> +++ llvm/trunk/tools/opt/CMakeLists.txt Sun Dec 29 21:36:05 2013
>> @@ -17,6 +17,9 @@ set(LLVM_LINK_COMPONENTS
>>    Vectorize
>>    )
>>
>> +# Support plugins.
>> +set(LLVM_NO_DEAD_STRIP 1)
>> +
>>  add_llvm_tool(opt
>>    AnalysisWrappers.cpp
>>    GraphPrinters.cpp
>>
>> Modified: llvm/trunk/unittests/ExecutionEngine/JIT/CMakeLists.txt
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/JIT/CMakeLists.txt?rev=198198&r1=198197&r2=198198&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/unittests/ExecutionEngine/JIT/CMakeLists.txt (original)
>> +++ llvm/trunk/unittests/ExecutionEngine/JIT/CMakeLists.txt Sun Dec 29
>> 21:36:05 2013
>> @@ -51,6 +51,9 @@ if(MSVC)
>>    list(APPEND JITTestsSources JITTests.def)
>>  endif()
>>
>> +# The JIT tests need to dlopen things.
>> +set(LLVM_NO_DEAD_STRIP 1)
>> +
>>  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