https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9c4ae0d05e8106e125d77…
commit 9c4ae0d05e8106e125d770f780724122ce497f3a
Author: Jérôme Gardou <jerome.gardou(a)reactos.org>
AuthorDate: Tue Apr 6 19:23:31 2021 +0200
Commit: Jérôme Gardou <jerome.gardou(a)reactos.org>
CommitDate: Tue Apr 6 19:26:33 2021 +0200
[CMAKE] Honor CMAKE_EXE_LINKER_FLAGS_INIT in GCC build
---
sdk/cmake/gcc.cmake | 2 +-
toolchain-clang.cmake | 10 ++++++----
toolchain-gcc.cmake | 1 +
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/sdk/cmake/gcc.cmake b/sdk/cmake/gcc.cmake
index 1b5604b6ccb..d5436cea69f 100644
--- a/sdk/cmake/gcc.cmake
+++ b/sdk/cmake/gcc.cmake
@@ -238,7 +238,7 @@ set(CMAKE_C_CREATE_SHARED_MODULE ${CMAKE_C_CREATE_SHARED_LIBRARY})
set(CMAKE_CXX_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_LIBRARY})
set(CMAKE_RC_CREATE_SHARED_MODULE ${CMAKE_RC_CREATE_SHARED_LIBRARY})
-set(CMAKE_EXE_LINKER_FLAGS "-nostdlib
-Wl,--enable-auto-image-base,--disable-auto-import,--disable-stdcall-fixup,--gc-sections")
+set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS_INIT}
-Wl,--disable-stdcall-fixup,--gc-sections")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS_INIT}
-Wl,--disable-stdcall-fixup")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS_INIT}
-Wl,--disable-stdcall-fixup")
diff --git a/toolchain-clang.cmake b/toolchain-clang.cmake
index 826f45f6b9a..2facc441683 100644
--- a/toolchain-clang.cmake
+++ b/toolchain-clang.cmake
@@ -55,10 +55,12 @@ set(CMAKE_ASM_CREATE_STATIC_LIBRARY ${CMAKE_C_CREATE_STATIC_LIBRARY})
set(CMAKE_C_STANDARD_LIBRARIES "-lgcc" CACHE STRING "Standard C
Libraries")
set(CMAKE_CXX_STANDARD_LIBRARIES "-lgcc" CACHE STRING "Standard C++
Libraries")
-set(CMAKE_SHARED_LINKER_FLAGS_INIT "-nostdlib
-Wl,--enable-auto-image-base,--disable-auto-import
-fuse-ld=${CMAKE_SYSROOT}/bin/${triplet}-ld")
-set(CMAKE_MODULE_LINKER_FLAGS_INIT "-nostdlib
-Wl,--enable-auto-image-base,--disable-auto-import
-fuse-ld=${CMAKE_SYSROOT}/bin/${triplet}-ld")
if (DEFINED CMAKE_SYSROOT)
- set(CMAKE_EXE_LINKER_FLAGS_INIT "-nostdlib
-fuse-ld=${CMAKE_SYSROOT}/bin/${GCC_TOOLCHAIN_PREFIX}ld")
+ set(LD_EXECUTABLE ${CMAKE_SYSROOT}/bin/${GCC_TOOLCHAIN_PREFIX}ld)
else()
- set(CMAKE_EXE_LINKER_FLAGS_INIT "-nostdlib
-fuse-ld=${GCC_TOOLCHAIN_PREFIX}ld")
+ set(LD_EXECUTABLE ${GCC_TOOLCHAIN_PREFIX}ld)
endif()
+
+set(CMAKE_SHARED_LINKER_FLAGS_INIT "-nostdlib
-Wl,--enable-auto-image-base,--disable-auto-import -fuse-ld=${LD_EXECUTABLE}")
+set(CMAKE_MODULE_LINKER_FLAGS_INIT "-nostdlib
-Wl,--enable-auto-image-base,--disable-auto-import -fuse-ld=${LD_EXECUTABLE}")
+set(CMAKE_EXE_LINKER_FLAGS_INIT "-nostdlib
-Wl,--enable-auto-image-base,--disable-auto-import -fuse-ld=${LD_EXECUTABLE}")
diff --git a/toolchain-gcc.cmake b/toolchain-gcc.cmake
index 276225ec663..56d1d8337bd 100644
--- a/toolchain-gcc.cmake
+++ b/toolchain-gcc.cmake
@@ -57,6 +57,7 @@ set(CMAKE_CXX_STANDARD_LIBRARIES "-lgcc" CACHE STRING
"Standard C++ Libraries")
set(CMAKE_SHARED_LINKER_FLAGS_INIT "-nostdlib
-Wl,--enable-auto-image-base,--disable-auto-import")
set(CMAKE_MODULE_LINKER_FLAGS_INIT "-nostdlib
-Wl,--enable-auto-image-base,--disable-auto-import")
+set(CMAKE_EXE_LINKER_FLAGS_INIT "-nostdlib
-Wl,--enable-auto-image-base,--disable-auto-import")
set(CMAKE_USER_MAKE_RULES_OVERRIDE
"${CMAKE_CURRENT_LIST_DIR}/overrides-gcc.cmake")