Merge branch 'miscfixes' of git://repo.or.cz/voxelands/voxelands-menche into next

This commit is contained in:
darkrose 2016-05-29 14:08:43 +10:00
commit e80e897fb5
3 changed files with 11 additions and 10 deletions

View File

@ -34,6 +34,7 @@ endif()
set(REBUILD_ICNS 0 CACHE BOOL "Rebuild icns from voxelands.svg .")
set(CPU_OPTS 0 CACHE BOOL "Enable CPU optimizations")
set(CPUTYPE native CACHE STRING "CPU to optimize for")
set(ENABLE_SSP 1 CACHE BOOL "Enable stack smashing protection")
set(ENABLE_SAFESTACK 1 CACHE BOOL "Enable SafeStack if supported (LLVM only)")
set(ENABLE_PIE 0 CACHE BOOL "Produce a Position Independent Executable")

View File

@ -373,10 +373,10 @@ else()
set(ARCH x86_64)
endif()
set(SAFETY_FLAGS "-fno-strict-aliasing -fwrapv -fvisibility=hidden")
set(SAFETY_LDFLAGS "")
set(SAFETY_FLAGS "-fwrapv")
set(SAFETY_LDFLAGS "-Wl,-z,relro,-z,now")
set(OPT_FLAGS "-O2 -fomit-frame-pointer")
set(OPT_LDFLAGS "-Wl,-O1,--as-needed,--discard-all,--no-undefined,-s,--sort-common,-z,relro,-z,now")
set(OPT_LDFLAGS "-Wl,-O1,--sort-common,-s")
if(ENABLE_SSP)
CHECK_CXX_COMPILER_FLAG("-fstack-protector-strong" HAS_FSTACK_STRONG)
@ -390,15 +390,15 @@ else()
CHECK_CXX_COMPILER_FLAG("-fsanitize=safe-stack" HAS_SAFESTACK)
if(HAS_SAFESTACK)
set(SAFETY_FLAGS "${SAFETY_FLAGS} -fsanitize=safe-stack")
set(SAFETY_LDFLAGS "-fsanitize=safe-stack -lrt")
set(SAFETY_LDFLAGS "${SAFETY_LDFLAGS} -fsanitize=safe-stack -lrt")
endif()
endif()
if(ENABLE_PIE)
set(SAFETY_FLAGS "${SAFETY_FLAGS} -fPIC -fPIE")
set(SAFETY_LDFLAGS "${LINKER_FLAGS} -Wl,-pie")
set(SAFETY_LDFLAGS "${SAFETY_LDFLAGS} -Wl,-pie")
endif()
if(CPU_OPTS)
set(OPT_FLAGS "${OPT_FLAGS} -march=native -mtune=native")
set(OPT_FLAGS "${OPT_FLAGS} -march=${CPUTYPE}")
endif()

View File

@ -312,8 +312,8 @@ bool UDPSocket::WaitData(int timeout_ms)
// Initialize time out struct
struct timeval tv;
tv.tv_sec = 0;
tv.tv_usec = timeout_ms * 1000;
tv.tv_sec = floor(timeout_ms / 1000) ;
tv.tv_usec = 1000 * (timeout_ms % 1000);
// select()
result = select(m_handle+1, &readset, NULL, NULL, &tv);
@ -574,8 +574,8 @@ bool TCPSocket::WaitData(int timeout_ms)
// Initialize time out struct
struct timeval tv;
tv.tv_sec = 0;
tv.tv_usec = timeout_ms * 1000;
tv.tv_sec = floor(timeout_ms / 1000);
tv.tv_usec = 1000 * (timeout_ms % 1000);
if (m_bstart != m_bend)
return true;