5133: Fix IPO build problems r=heinrich5991 a=def-

`@Kaffeine` 

Windows x86-64 with MinGW worked, previously:
```
-rwxr-xr-x 1 deen deen 755K May 15 11:38 config_retrieve.exe*
-rwxr-xr-x 1 deen deen 756K May 15 11:38 config_store.exe*
-rwxr-xr-x 1 deen deen 2.8M May 15 11:38 DDNet.exe*
-rwxr-xr-x 1 deen deen 2.1M May 15 11:38 DDNet-Server.exe*
-rwxr-xr-x 1 deen deen 761K May 15 11:38 dilate.exe*
-rwxr-xr-x 1 deen deen 763K May 15 11:38 map_convert_07.exe*
-rwxr-xr-x 1 deen deen 756K May 15 11:38 map_diff.exe*
-rwxr-xr-x 1 deen deen 761K May 15 11:38 map_extract.exe*
```
Now:
```
-rwxr-xr-x 1 deen deen 256K May 16 00:26 config_retrieve.exe*
-rwxr-xr-x 1 deen deen 282K May 16 00:26 config_store.exe*
-rwxr-xr-x 1 deen deen 2.8M May 16 00:26 DDNet.exe*
-rwxr-xr-x 1 deen deen 2.0M May 16 00:26 DDNet-Server.exe*
-rwxr-xr-x 1 deen deen 271K May 16 00:26 dilate.exe*
-rwxr-xr-x 1 deen deen 289K May 16 00:26 map_convert_07.exe*
-rwxr-xr-x 1 deen deen 261K May 16 00:26 map_diff.exe*
-rwxr-xr-x 1 deen deen 278K May 16 00:26 map_extract.exe*
```

## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


5138: No gold preference (fixes #5136) r=heinrich5991 a=def-

`@Kaffeine` lld is used on some systems, we also have instructions for mold in readme, both are faster than gold.

## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: def <dennis@felsin9.de>
Co-authored-by: Dennis Felsing <dennis@felsin9.de>
This commit is contained in:
bors[bot] 2022-05-18 07:12:29 +00:00 committed by GitHub
commit 3d6e683fdd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 24 deletions

View file

@ -96,16 +96,17 @@ endif()
set(AUTO_DEPENDENCIES_DEFAULT OFF)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR DEV)
set(AUTO_IPO OFF)
else()
set(AUTO_IPO ON)
endif()
if(MSVC)
elseif(MSVC)
# For some reason on MSVC platform the client and server binaries
# become even bigger with IPO enabled.
set(AUTO_IPO OFF)
elseif(MINGW AND TARGET_CPU_ARCHITECTURE STREQUAL "x86")
# DWARF error: could not find variable specification and further failures
set(AUTO_IPO OFF)
else()
set(AUTO_IPO ON)
endif()
set(AUTO_VULKAN_BACKEND ON)
@ -281,6 +282,7 @@ if(NOT MSVC AND NOT HAIKU)
add_c_compiler_flag_if_supported(OUR_FLAGS_OWN -Wformat=2) # Warn about format strings.
add_c_compiler_flag_if_supported(OUR_FLAGS_DEP -Wno-implicit-function-declaration)
add_c_compiler_flag_if_supported(OUR_FLAGS_OWN -Wno-nullability-completeness) # Mac OS build on github
add_c_compiler_flag_if_supported(OUR_FLAGS_OWN -Wno-tautological-constant-out-of-range-compare) # Check needed for x86, but warns on x86-64
add_c_compiler_flag_if_supported(OUR_FLAGS_OWN -Wduplicated-cond)
add_c_compiler_flag_if_supported(OUR_FLAGS_OWN -Wduplicated-branches)
add_c_compiler_flag_if_supported(OUR_FLAGS_OWN -Wlogical-op)
@ -294,23 +296,6 @@ if(NOT MSVC AND NOT HAIKU)
# add_c_compiler_flag_if_supported(OUR_FLAGS_OWN -Wuseless-cast) # TODO: Enable for C++ code except gtest
endif()
if(UNIX AND NOT APPLE)
# This can be disabled by configuring with -DUSE_GOLD=FALSE
if(NOT DEFINED USE_GOLD)
execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version ERROR_QUIET OUTPUT_VARIABLE ld_version)
if("${ld_version}" MATCHES "GNU gold")
set(USE_GOLD TRUE CACHE BOOL "Use GNU gold linker")
else()
set(USE_GOLD FALSE CACHE BOOL "Use GNU gold linker")
endif()
endif()
message(STATUS "GNU gold linker enabled: ${USE_GOLD}")
if(USE_GOLD)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold -Wl,--disable-new-dtags")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=gold -Wl,--disable-new-dtags")
endif()
endif()
if(MSVC)
if(EXCEPTION_HANDLING)
add_c_compiler_flag_if_supported(OUR_FLAGS /DCONF_EXCEPTION_HANDLING)

View file

@ -302,7 +302,7 @@ bool CMapLayers::STileLayerVisuals::Init(unsigned int Width, unsigned int Height
{
m_Width = Width;
m_Height = Height;
if(Width == 0 || Height == 0)
if(Width == 0 || Height == 0 || Width >= std::numeric_limits<std::ptrdiff_t>::max() || Height >= std::numeric_limits<std::ptrdiff_t>::max())
return false;
m_pTilesOfLayer = new CMapLayers::STileLayerVisuals::STileVisual[Height * Width];