From d37b1007c1612ce9755e6e27a900c1fb5557c0f3 Mon Sep 17 00:00:00 2001 From: Dennis Felsing Date: Thu, 27 Jul 2023 17:18:19 +0200 Subject: [PATCH 1/4] Fix linking wiht -fstack-protector-strong on MinGW src/engine/client/backend/opengl/backend_opengl.cpp:1599: undefined reference to `__stack_chk_fail' --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ec2d79283..e2f6790df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -297,6 +297,9 @@ if(NOT MSVC AND NOT HAIKU) if(SECURITY_COMPILER_FLAGS) # Protect the stack pointer. add_cxx_compiler_flag_if_supported(OUR_FLAGS -fstack-protector-strong) + if(MINGW) + add_linker_flag_if_supported(OUR_FLAGS_LINK -lssp) + endif() endif() # Disable exceptions as DDNet does not use them. From a7ae13db4f2a8aba327cbc80fce4ebce04c90219 Mon Sep 17 00:00:00 2001 From: Dennis Felsing Date: Thu, 27 Jul 2023 17:25:42 +0200 Subject: [PATCH 2/4] Fix glslangValidator.exe executable bit --- ddnet-libs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ddnet-libs b/ddnet-libs index 328fd20b5..cc835fd82 160000 --- a/ddnet-libs +++ b/ddnet-libs @@ -1 +1 @@ -Subproject commit 328fd20b5d94b253d699130390bc23c72fae8dca +Subproject commit cc835fd82641cc966bdf3e22af3a7f2491213deb From 3497bfdcf32ebbcdc5caeea65aed9344bc1be7ab Mon Sep 17 00:00:00 2001 From: Dennis Felsing Date: Thu, 27 Jul 2023 19:18:01 +0200 Subject: [PATCH 3/4] glslangValidator -> glslang Following glslang 12.3.0, see https://github.com/KhronosGroup/glslang/releases/tag/12.3.0 --- cmake/BuildVulkanShaders.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/BuildVulkanShaders.cmake b/cmake/BuildVulkanShaders.cmake index b15ec201f..3eeffe55d 100644 --- a/cmake/BuildVulkanShaders.cmake +++ b/cmake/BuildVulkanShaders.cmake @@ -1,4 +1,6 @@ -find_program(GLSLANG_VALIDATOR_PROGRAM glslangValidator) +find_program(GLSLANG_VALIDATOR_PROGRAM + NAMES glslang glslangValidator +) find_program(SPIRV_OPTIMIZER_PROGRAM spirv-opt) set(GLSLANG_VALIDATOR_PROGRAM_FOUND TRUE) From 81495294a82c7882b3d504fd297b9f991b11c266 Mon Sep 17 00:00:00 2001 From: Dennis Felsing Date: Fri, 28 Jul 2023 14:28:22 +0200 Subject: [PATCH 4/4] Add libssp-0.dll --- CMakeLists.txt | 5 +++++ cmake/FindSSP.cmake | 17 +++++++++++++++++ ddnet-libs | 2 +- 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 cmake/FindSSP.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index e2f6790df..17c605be7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -576,6 +576,10 @@ if(EXCEPTION_HANDLING) find_package(ExceptionHandling) endif() +if(SECURITY_COMPILER_FLAGS) + find_package(SSP) +endif() + if(TARGET_OS AND TARGET_OS STREQUAL "mac") find_program(CMAKE_OTOOL otool) find_program(DMGBUILD dmgbuild) @@ -1758,6 +1762,7 @@ set(COPY_FILES ${DISCORDSDK_COPY_FILES} ${VULKAN_COPY_FILES} ${EXCEPTION_HANDLING_COPY_FILES} + ${SSP_COPY_FILES} ) file(COPY ${COPY_FILES} DESTINATION .) # Don't add integration test files to COPY_FILES since we don't want to add diff --git a/cmake/FindSSP.cmake b/cmake/FindSSP.cmake new file mode 100644 index 000000000..d1923c2e9 --- /dev/null +++ b/cmake/FindSSP.cmake @@ -0,0 +1,17 @@ +if(TARGET_OS STREQUAL "windows") + set_extra_dirs_lib(SSP ssp) + find_file(SSP_LIBRARY + NAMES libssp-0.dll + HINTS ${HINTS_SSP_LIBDIR} + PATHS ${PATHS_SSP_LIBDIR} + ${CROSSCOMPILING_NO_CMAKE_SYSTEM_PATH} + ) + + is_bundled(SSP_BUNDLED "${SSP_LIBRARY}") + if(NOT SSP_BUNDLED) + message(FATAL_ERROR "could not find ssp paths") + endif() + set(SSP_COPY_FILES + "${EXTRA_SSP_LIBDIR}/libssp-0.dll" + ) +endif() diff --git a/ddnet-libs b/ddnet-libs index cc835fd82..59d64dbb3 160000 --- a/ddnet-libs +++ b/ddnet-libs @@ -1 +1 @@ -Subproject commit cc835fd82641cc966bdf3e22af3a7f2491213deb +Subproject commit 59d64dbb36ade02607ad20a7f3a45605ab1de80d