From 462658df4f2f06766b923a409b688436d647b3ca Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 1 Jan 2016 23:23:54 +0000 Subject: [PATCH 1/7] Get rid of doubly-defined NDEBUG --- external/unbound/config.h.cmake.in | 7 ------- 1 file changed, 7 deletions(-) diff --git a/external/unbound/config.h.cmake.in b/external/unbound/config.h.cmake.in index 861020ecd..9658c8693 100644 --- a/external/unbound/config.h.cmake.in +++ b/external/unbound/config.h.cmake.in @@ -768,13 +768,6 @@ #define _LARGEFILE_SOURCE 1 #endif - - - -#ifndef UNBOUND_DEBUG -# define NDEBUG -#endif - /** Use small-ldns codebase */ #define USE_SLDNS 1 #ifdef HAVE_SSL From ee6f2cb71f4053b58be1ea15bcbe099062bbbd7c Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 1 Jan 2016 02:47:48 +0000 Subject: [PATCH 2/7] IP_TOS not supported before Windows7 --- contrib/epee/include/net/abstract_tcp_server2.inl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/contrib/epee/include/net/abstract_tcp_server2.inl b/contrib/epee/include/net/abstract_tcp_server2.inl index 51c6f3501..5bf65d7fd 100644 --- a/contrib/epee/include/net/abstract_tcp_server2.inl +++ b/contrib/epee/include/net/abstract_tcp_server2.inl @@ -160,13 +160,16 @@ PRAGMA_WARNING_DISABLE_VS(4355) boost::bind(&connection::handle_read, self, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred))); - +#if !defined(_WIN32) || !defined(__i686) + // not supported before Windows7, too lazy for runtime check + // Just exclude for 32bit windows builds //set ToS flag int tos = get_tos_flag(); boost::asio::detail::socket_option::integer< IPPROTO_IP, IP_TOS > optionTos( tos ); socket_.set_option( optionTos ); //_dbg1("Set ToS flag to " << tos); +#endif boost::asio::ip::tcp::no_delay noDelayOption(false); socket_.set_option(noDelayOption); From 26aac680951ccb761bf27237e82fff560785d4be Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sat, 2 Jan 2016 19:39:03 +0000 Subject: [PATCH 3/7] Fix release flags flags were being accumulated instead of being set. Win32 was getting -O2 -DNDEBUG -Ofast -DNDEBUG etc... Also for Win32, stay compatible to WinXP --- CMakeLists.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 09cd54774..fed936344 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,6 +70,9 @@ endif() if(WIN32 OR ARM7 OR ARM6) set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG") set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG") +else() + set(CMAKE_C_FLAGS_RELEASE "-Ofast -DNDEBUG -Wno-unused-variable") + set(CMAKE_CXX_FLAGS_RELEASE "-Ofast -DNDEBUG -Wno-unused-variable") endif() # set this to 0 if per-block checkpoint needs to be disabled @@ -310,6 +313,9 @@ else() # mingw doesn't support LTO (multiple definition errors at link time) set(USE_LTO_DEFAULT false) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--stack,10485760") + if(NOT BUILD_64) + add_definitions(-DWINVER=0x0501 -D_WIN32_WINNT=0x0501) + endif() endif() set(C_WARNINGS "-Waggregate-return -Wnested-externs -Wold-style-definition -Wstrict-prototypes") set(CXX_WARNINGS "-Wno-reorder -Wno-missing-field-initializers") @@ -353,8 +359,6 @@ else() set(DEBUG_FLAGS "-g3 -O0") endif() - set(RELEASE_FLAGS "-Ofast -DNDEBUG -Wno-unused-variable") - if(NOT DEFINED USE_LTO_DEFAULT) set(USE_LTO_DEFAULT true) endif() From 28b82718ffcb3ba93a88c20453e9fd4890613b20 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sun, 3 Jan 2016 08:22:06 +0000 Subject: [PATCH 4/7] Avoid cmake-3.x block comment syntax --- external/miniupnpc/CMakeLists.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/external/miniupnpc/CMakeLists.txt b/external/miniupnpc/CMakeLists.txt index 51331ecb5..1e7645a9d 100644 --- a/external/miniupnpc/CMakeLists.txt +++ b/external/miniupnpc/CMakeLists.txt @@ -4,7 +4,8 @@ project (miniupnpc C) set (MINIUPNPC_VERSION 1.9) set (MINIUPNPC_API_VERSION 15) -#[[ - we comment out this block as we don't support these other build types +# - we comment out this block as we don't support these other build types +if(0) if (NOT CMAKE_BUILD_TYPE) if (WIN32) set (DEFAULT_BUILD_TYPE MinSizeRel) @@ -15,7 +16,7 @@ if (NOT CMAKE_BUILD_TYPE) "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE) endif() -]] +endif() option (UPNPC_BUILD_STATIC "Build static library" TRUE) option (UPNPC_BUILD_SHARED "Build shared library" FALSE) @@ -41,7 +42,8 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") add_definitions (-D_DARWIN_C_SOURCE) endif () -#[[ - we comment out this block as we already set flags +# - we comment out this block as we already set flags +if(0) # Set compiler specific build flags if (CMAKE_COMPILER_IS_GNUC) # Set our own default flags at first run. @@ -64,7 +66,7 @@ if (CMAKE_COMPILER_IS_GNUC) endif (NOT CONFIGURED) endif () -]] +endif() configure_file (miniupnpcstrings.h.cmake ${CMAKE_BINARY_DIR}/miniupnpcstrings.h) include_directories (${CMAKE_BINARY_DIR}) From da0bce3472b593704f63b112e345b4dea03fca2d Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sun, 3 Jan 2016 08:22:38 +0000 Subject: [PATCH 5/7] Use CMAKE_LINKER, not hardcoded "ld" --- src/blocks/CMakeLists.txt | 4 ++-- src/daemon/CMakeLists.txt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/blocks/CMakeLists.txt b/src/blocks/CMakeLists.txt index b421d8bad..f65503fbc 100644 --- a/src/blocks/CMakeLists.txt +++ b/src/blocks/CMakeLists.txt @@ -30,8 +30,8 @@ if(APPLE) add_library(blocks STATIC blockexports.c) set_target_properties(blocks PROPERTIES LINKER_LANGUAGE C) else() - add_custom_command(OUTPUT blocks.o COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && ld -r -b binary -o ${CMAKE_CURRENT_BINARY_DIR}/blocks.o blocks.dat) - add_custom_command(OUTPUT testnet_blocks.o COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && ld -r -b binary -o ${CMAKE_CURRENT_BINARY_DIR}/testnet_blocks.o testnet_blocks.dat) + add_custom_command(OUTPUT blocks.o COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && ${CMAKE_LINKER} -r -b binary -o ${CMAKE_CURRENT_BINARY_DIR}/blocks.o blocks.dat) + add_custom_command(OUTPUT testnet_blocks.o COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && ${CMAKE_LINKER} -r -b binary -o ${CMAKE_CURRENT_BINARY_DIR}/testnet_blocks.o testnet_blocks.dat) add_library(blocks STATIC blocks.o testnet_blocks.o blockexports.c) set_target_properties(blocks PROPERTIES LINKER_LANGUAGE C) endif() diff --git a/src/daemon/CMakeLists.txt b/src/daemon/CMakeLists.txt index b2676a7ce..e456ccba6 100644 --- a/src/daemon/CMakeLists.txt +++ b/src/daemon/CMakeLists.txt @@ -29,9 +29,9 @@ set(blocksdat "") if(PER_BLOCK_CHECKPOINT) if(APPLE) - add_custom_command(OUTPUT blocksdat.o COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && touch stub.c && ${CMAKE_C_COMPILER} -o stub.o -c stub.c COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && ld -r -sectcreate __DATA __blocks_dat ../blocks/checkpoints.dat -o ${CMAKE_CURRENT_BINARY_DIR}/blocksdat.o stub.o && rm -f stub.*) + add_custom_command(OUTPUT blocksdat.o COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && touch stub.c && ${CMAKE_C_COMPILER} -o stub.o -c stub.c COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && ${CMAKE_LINKER} -r -sectcreate __DATA __blocks_dat ../blocks/checkpoints.dat -o ${CMAKE_CURRENT_BINARY_DIR}/blocksdat.o stub.o && rm -f stub.*) else() - add_custom_command(OUTPUT blocksdat.o COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && cp ../blocks/checkpoints.dat blocks.dat && ld -r -b binary -o ${CMAKE_CURRENT_BINARY_DIR}/blocksdat.o blocks.dat && rm -f blocks.dat) + add_custom_command(OUTPUT blocksdat.o COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && cp ../blocks/checkpoints.dat blocks.dat && ${CMAKE_LINKER} -r -b binary -o ${CMAKE_CURRENT_BINARY_DIR}/blocksdat.o blocks.dat && rm -f blocks.dat) endif() set(blocksdat "blocksdat.o") endif() From a561afa18b5e0bf82c890d99fb0caafaee2da80c Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sun, 3 Jan 2016 11:57:35 +0000 Subject: [PATCH 6/7] ARM chars are unsigned --- contrib/epee/include/misc_log_ex.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/epee/include/misc_log_ex.h b/contrib/epee/include/misc_log_ex.h index b4ba4b7e8..d1451ff12 100644 --- a/contrib/epee/include/misc_log_ex.h +++ b/contrib/epee/include/misc_log_ex.h @@ -419,7 +419,7 @@ namespace log_space std::string buf(buffer, buffer_len); for(size_t i = 0; i!= buf.size(); i++) { - if(buf[i] == 7 || buf[i] == -107) + if(buf[i] == 7 || (buf[i]&0xff) == 0x95) buf[i] = '^'; } From d26e7d0b3a53e0e7a38314b39a108a272d24c2f5 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sun, 3 Jan 2016 12:58:08 +0000 Subject: [PATCH 7/7] ARMv7 optimization flags are too aggressive --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fed936344..ae2a19c01 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -346,8 +346,8 @@ else() if(ARM7) message(STATUS "Setting ARM7 C and C++ flags") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -mcpu=cortex-a7 -mfloat-abi=hard -mfpu=vfpv4 -funsafe-math-optimizations -mtune=cortex-a7") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -mcpu=cortex-a7 -mfloat-abi=hard -mfpu=vfpv4 -funsafe-math-optimizations -mtune=cortex-a7") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -mfloat-abi=hard") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -mfloat-abi=hard") endif() if(APPLE)