Remove --no-add-needed

--no-add-needed is the default behavior since binutils 2.22, released in
2011. This option also breaks lld compatibility.
This commit is contained in:
Alex Xu (Hello71) 2022-04-06 09:10:26 -04:00 committed by Jonathan White
parent e7fe3ff968
commit 2b4d286de6

View File

@ -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()