From fc3dae1cd04cb58c330ed5bc7b833b612b160fb2 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Mon, 22 Jun 2015 15:06:17 +0000 Subject: [PATCH] Support Solaris unused sections' gc link syntax. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit It is not clear if this would work or not with LLVM_NO_DEAD_STRIP binaries, so be conservative for now. Patch by Xan López. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240287 91177308-0d34-0410-b5e6-96231b3b80d8 --- cmake/modules/AddLLVM.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake index 67c20a220a2..3eca53e3055 100644 --- a/cmake/modules/AddLLVM.cmake +++ b/cmake/modules/AddLLVM.cmake @@ -186,6 +186,9 @@ function(add_link_opts target_name) # ld64's implementation of -dead_strip breaks tools that use plugins. 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") elseif(NOT WIN32 AND NOT LLVM_LINKER_IS_GOLD) # Object files are compiled with -ffunction-data-sections. # Versions of bfd ld < 2.23.1 have a bug in --gc-sections that breaks -- 2.34.1