[llvm] r220174 - Always use -Wl,-gc-sections on our build.
Rafael Espindola
rafael.espindola at gmail.com
Sun Oct 19 16:24:46 PDT 2014
Author: rafael
Date: Sun Oct 19 18:24:46 2014
New Revision: 220174
URL: http://llvm.org/viewvc/llvm-project?rev=220174&view=rev
Log:
Always use -Wl,-gc-sections on our build.
Both bfd ld and gold correctly handle --export-dynamic, so gc-sections is safe even for binaries
that support plugins.
Modified:
llvm/trunk/cmake/modules/AddLLVM.cmake
Modified: llvm/trunk/cmake/modules/AddLLVM.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddLLVM.cmake?rev=220174&r1=220173&r2=220174&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/AddLLVM.cmake (original)
+++ llvm/trunk/cmake/modules/AddLLVM.cmake Sun Oct 19 18:24:46 2014
@@ -141,15 +141,18 @@ function(add_llvm_symbol_exports target_
endfunction(add_llvm_symbol_exports)
function(add_dead_strip target_name)
- if(NOT LLVM_NO_DEAD_STRIP)
- if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ # ld64's implementation of -dead_strip breaks tools that use plugins.
+ if(NOT LLVM_NO_DEAD_STRIP)
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()
+ elseif(NOT WIN32)
+ # Object files are compiled with -ffunction-data-sections.
+ # On ELF --gc-sections handles --export-dynamic correctly, so we can always
+ # use it.
+ set_property(TARGET ${target_name} APPEND_STRING PROPERTY
+ LINK_FLAGS " -Wl,--gc-sections")
endif()
endfunction(add_dead_strip)
More information about the llvm-commits
mailing list