summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-10-19 23:24:46 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-10-19 23:24:46 +0000
commitc4df33be5af658c3ef5316bb6dc4cb370ec9a138 (patch)
treeda31dcf2b86d2ae3bc44eff59efef7ecca29f5a4 /llvm
parent941a3244ffe0fbed51f977ace7358fbf5c924479 (diff)
downloadbcm5719-llvm-c4df33be5af658c3ef5316bb6dc4cb370ec9a138.tar.gz
bcm5719-llvm-c4df33be5af658c3ef5316bb6dc4cb370ec9a138.zip
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. llvm-svn: 220174
Diffstat (limited to 'llvm')
-rw-r--r--llvm/cmake/modules/AddLLVM.cmake15
1 files changed, 9 insertions, 6 deletions
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 284912c19c1..2e6b8247b05 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -141,15 +141,18 @@ function(add_llvm_symbol_exports target_name export_file)
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)
OpenPOWER on IntegriCloud