From 2b4d286de6a92a87a6e5f007d839009ce4610c9c Mon Sep 17 00:00:00 2001 From: "Alex Xu (Hello71)" Date: Wed, 6 Apr 2022 09:10:26 -0400 Subject: [PATCH] Remove --no-add-needed --no-add-needed is the default behavior since binutils 2.22, released in 2011. This option also breaks lld compatibility. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 55395a4af..04626c3ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -336,9 +336,9 @@ check_add_gcc_compiler_flag("-Wcast-align") if(UNIX AND NOT APPLE) check_add_gcc_compiler_flag("-Qunused-arguments") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-add-needed -Wl,--as-needed -Wl,--no-undefined") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--as-needed -Wl,--no-undefined") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,relro,-z,now -pie") - set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-add-needed -Wl,--as-needed") + set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--as-needed") set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-z,relro,-z,now") endif()