[PATCH] D81545: [cmake] Don't pass -z discard-unused to Illumos ld
Rainer Orth via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 12 01:03:24 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2feb72bcd58c: [cmake] Don't pass -z discard-unused to Illumos ld (authored by ro).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D81545/new/
https://reviews.llvm.org/D81545
Files:
llvm/cmake/modules/AddLLVM.cmake
Index: llvm/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -240,8 +240,14 @@
set_property(TARGET ${target_name} APPEND_STRING PROPERTY
LINK_FLAGS " -Wl,-dead_strip")
elseif(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
- set_property(TARGET ${target_name} APPEND_STRING PROPERTY
- LINK_FLAGS " -Wl,-z -Wl,discard-unused=sections")
+ # Support for ld -z discard-unused=sections was only added in
+ # Solaris 11.4.
+ include(CheckLinkerFlag)
+ check_linker_flag("-Wl,-z,discard-unused=sections" LINKER_SUPPORTS_Z_DISCARD_UNUSED)
+ if (LINKER_SUPPORTS_Z_DISCARD_UNUSED)
+ set_property(TARGET ${target_name} APPEND_STRING PROPERTY
+ LINK_FLAGS " -Wl,-z,discard-unused=sections")
+ endif()
elseif(NOT WIN32 AND NOT LLVM_LINKER_IS_GOLD AND
NOT ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD|AIX")
# Object files are compiled with -ffunction-data-sections.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81545.270316.patch
Type: text/x-patch
Size: 1127 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200612/39f83f90/attachment.bin>
More information about the llvm-commits
mailing list