From 29876a588771cfb55443ad2e7b7b1b2259a31d3d Mon Sep 17 00:00:00 2001 From: oltolm Date: Tue, 18 Apr 2023 20:45:53 +0200 Subject: [PATCH] next try --- CMakeLists.txt | 5 +---- ci/toolchain/aarch64-w64-mingw32-clang.cmake | 4 ---- ci/toolchain/i686-w64-mingw32-clang.cmake | 4 ---- ci/toolchain/x86_64-w64-mingw32-clang.cmake | 4 ---- tests/apps/CMakeLists.txt | 2 +- 5 files changed, 2 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b282be6..f3aed2f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,8 +27,6 @@ add_link_options( -static-libstdc++ ) -link_libraries(ssp) - find_package (WinDbg) include_directories ( @@ -61,13 +59,12 @@ include (StaticCRT) if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "8.0" OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "8.3") add_compile_options (-fstack-protector-all) - add_link_options(-lssp) + link_libraries(ssp) endif () if (CMAKE_SIZEOF_VOID_P EQUAL 8) add_compile_definitions (HAVE_WIN64=1) else () - add_link_options (-Wl,--enable-stdcall-fixup) add_compile_definitions (HAVE_WIN64=0) endif () diff --git a/ci/toolchain/aarch64-w64-mingw32-clang.cmake b/ci/toolchain/aarch64-w64-mingw32-clang.cmake index e688418..15d98ce 100644 --- a/ci/toolchain/aarch64-w64-mingw32-clang.cmake +++ b/ci/toolchain/aarch64-w64-mingw32-clang.cmake @@ -18,7 +18,3 @@ set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) set (CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) - -# Statically link CRT -set (CMAKE_C_FLAGS "--start-no-unused-arguments -Wl,-Bstatic -lunwind -Wl,-Bdynamic --end-no-unused-arguments") -set (CMAKE_CXX_FLAGS "--start-no-unused-arguments -static-libstdc++ -Wl,-Bstatic -lunwind -Wl,-Bdynamic --end-no-unused-arguments") diff --git a/ci/toolchain/i686-w64-mingw32-clang.cmake b/ci/toolchain/i686-w64-mingw32-clang.cmake index d4b43ac..a679ece 100644 --- a/ci/toolchain/i686-w64-mingw32-clang.cmake +++ b/ci/toolchain/i686-w64-mingw32-clang.cmake @@ -18,7 +18,3 @@ set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) set (CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) - -# Statically link CRT -set (CMAKE_C_FLAGS "--start-no-unused-arguments -Wl,-Bstatic -lunwind -Wl,-Bdynamic --end-no-unused-arguments") -set (CMAKE_CXX_FLAGS "--start-no-unused-arguments -static-libstdc++ -Wl,-Bstatic -lunwind -Wl,-Bdynamic --end-no-unused-arguments") diff --git a/ci/toolchain/x86_64-w64-mingw32-clang.cmake b/ci/toolchain/x86_64-w64-mingw32-clang.cmake index dd28070..0369a6d 100644 --- a/ci/toolchain/x86_64-w64-mingw32-clang.cmake +++ b/ci/toolchain/x86_64-w64-mingw32-clang.cmake @@ -18,7 +18,3 @@ set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) set (CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) - -# Statically link CRT -set (CMAKE_C_FLAGS "--start-no-unused-arguments -Wl,-Bstatic -lunwind -Wl,-Bdynamic --end-no-unused-arguments") -set (CMAKE_CXX_FLAGS "--start-no-unused-arguments -static-libstdc++ -Wl,-Bstatic -lunwind -Wl,-Bdynamic --end-no-unused-arguments") diff --git a/tests/apps/CMakeLists.txt b/tests/apps/CMakeLists.txt index 31a4afd..b16f71c 100644 --- a/tests/apps/CMakeLists.txt +++ b/tests/apps/CMakeLists.txt @@ -140,7 +140,7 @@ add_test_executable (ud2 ud2.c) if (MINGW) target_compile_options (stack_buffer_overflow PRIVATE -fstack-protector-all) target_link_options (stack_buffer_overflow PRIVATE -fstack-protector-all) - target_link_libraries (stack_buffer_overflow PRIVATE -Wl,-Bstatic -lssp -Wl,-Bdynamic) + target_link_libraries (stack_buffer_overflow PRIVATE ssp) endif () if (MSVC) target_compile_options (stack_buffer_overflow PRIVATE /GS)