summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2014-10-20 12:12:21 +0000
committerNAKAMURA Takumi <geek4civic@gmail.com>2014-10-20 12:12:21 +0000
commit7c771b0293990f8485da02debba6ee515064c97a (patch)
tree855ba5549863390bc5456975a37e504ef711a6d2
parent19d010b85136b7491bae94df4698305ee0bfffcd (diff)
downloadllvm-7c771b0293990f8485da02debba6ee515064c97a.tar.gz
Revert r220174, "Always use -Wl,-gc-sections on our build."
It dropped required functions for plugins with gnu ld 2.20 and 2.21. Failing Tests (1): LLVM :: Feature/load_module.ll Hello: bin/opt: symbol lookup error: lib/LLVMHello.so: undefined symbol: _ZN4llvm11raw_ostream13write_escapedENS_9StringRefEb Failing Tests (1): Clang :: Frontend/plugins.c error: unable to load plugin 'lib/PrintFunctionNames.so': 'lib/PrintFunctionNames.so: undefined symbol: _ZN5clang15PluginASTAction6anchorEv' I think we should inspect linker's version or behavior to introduce --gc-sections for --export-dynamic. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220198 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--cmake/modules/AddLLVM.cmake15
1 files changed, 6 insertions, 9 deletions
diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
index 2e6b8247b055..284912c19c15 100644
--- a/cmake/modules/AddLLVM.cmake
+++ b/cmake/modules/AddLLVM.cmake
@@ -141,18 +141,15 @@ function(add_llvm_symbol_exports target_name export_file)
endfunction(add_llvm_symbol_exports)
function(add_dead_strip target_name)
- if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
- # ld64's implementation of -dead_strip breaks tools that use plugins.
- if(NOT LLVM_NO_DEAD_STRIP)
+ 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()
- 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)