mdbx: use -fno-semantic-interposition.

This commit is contained in:
Leonid Yuriev 2022-01-25 18:19:56 +03:00
parent 86d4e37327
commit 207124e7fb
2 changed files with 5 additions and 2 deletions

View File

@ -31,8 +31,7 @@ CFLAGS_EXTRA ?=
LD ?= ld LD ?= ld
MDBX_BUILD_OPTIONS ?=-DNDEBUG=1 MDBX_BUILD_OPTIONS ?=-DNDEBUG=1
MDBX_BUILD_TIMESTAMP ?=$(shell date +%Y-%m-%dT%H:%M:%S%z) MDBX_BUILD_TIMESTAMP ?=$(shell date +%Y-%m-%dT%H:%M:%S%z)
CFLAGS ?= -std=gnu11 -O2 -g -Wall -Werror -Wextra -Wpedantic -ffunction-sections -fPIC -fvisibility=hidden -pthread -Wno-error=attributes $(CFLAGS_EXTRA) CFLAGS ?= $(eval CFLAGS := -std=gnu11 -O2 -g -Wall -Werror -Wextra -Wpedantic -ffunction-sections -fPIC -fvisibility=hidden -pthread -Wno-error=attributes $$(shell PROBE=$$$$([ -f mdbx.c ] && echo mdbx.c || echo src/core.c); for opt in -fno-semantic-interposition -Wno-tautological-compare; do $(CC) '-DMDBX_BUILD_FLAGS="probe"' $$$${opt} -c $$$${PROBE} -o /dev/null 2>/dev/null >/dev/null && echo "$$$${opt} "; done)$(CFLAGS_EXTRA))$(CFLAGS)
# -Wno-tautological-compare
CXX ?= g++ CXX ?= g++
# Choosing C++ standard with deferred simple variable expansion trick # Choosing C++ standard with deferred simple variable expansion trick
CXXSTD ?= $(eval CXXSTD := $$(shell PROBE=$$$$([ -f mdbx.c++ ] && echo mdbx.c++ || echo src/mdbx.c++); for std in gnu++23 c++23 gnu++2b c++2b gnu++20 c++20 gnu++2a c++2a gnu++17 c++17 gnu++1z c++1z gnu++14 c++14 gnu++1y c++1y gnu+11 c++11 gnu++0x c++0x; do $(CXX) -std=$$$${std} -c $$$${PROBE} -o /dev/null 2>std-$$$${std}.err >/dev/null && echo "-std=$$$${std}" && exit; done))$(CXXSTD) CXXSTD ?= $(eval CXXSTD := $$(shell PROBE=$$$$([ -f mdbx.c++ ] && echo mdbx.c++ || echo src/mdbx.c++); for std in gnu++23 c++23 gnu++2b c++2b gnu++20 c++20 gnu++2a c++2a gnu++17 c++17 gnu++1z c++1z gnu++14 c++14 gnu++1y c++1y gnu+11 c++11 gnu++0x c++0x; do $(CXX) -std=$$$${std} -c $$$${PROBE} -o /dev/null 2>std-$$$${std}.err >/dev/null && echo "-std=$$$${std}" && exit; done))$(CXXSTD)

View File

@ -227,6 +227,7 @@ else()
check_compiler_flag("-Wextra" CC_HAS_WEXTRA) check_compiler_flag("-Wextra" CC_HAS_WEXTRA)
check_compiler_flag("-Werror" CC_HAS_WERROR) check_compiler_flag("-Werror" CC_HAS_WERROR)
check_compiler_flag("-fexceptions" CC_HAS_FEXCEPTIONS) check_compiler_flag("-fexceptions" CC_HAS_FEXCEPTIONS)
check_compiler_flag("-fno-semantic-interposition" CC_HAS_FNO_SEMANTIC_INTERPOSITION)
if(CMAKE_CXX_COMPILER_LOADED) if(CMAKE_CXX_COMPILER_LOADED)
check_cxx_compiler_flag("-fcxx-exceptions" CC_HAS_FCXX_EXCEPTIONS) check_cxx_compiler_flag("-fcxx-exceptions" CC_HAS_FCXX_EXCEPTIONS)
endif() endif()
@ -555,6 +556,9 @@ macro(setup_compile_flags)
if(CC_HAS_FCXX_EXCEPTIONS) if(CC_HAS_FCXX_EXCEPTIONS)
add_compile_flags("CXX" "-fcxx-exceptions" "-frtti") add_compile_flags("CXX" "-fcxx-exceptions" "-frtti")
endif() endif()
if(CC_HAS_FNO_SEMANTIC_INTERPOSITION)
add_compile_flags("C;CXX" "-fno-semantic-interposition")
endif()
if(MSVC) if(MSVC)
# checks for /EHa or /clr options exists, # checks for /EHa or /clr options exists,
# i.e. is enabled structured async WinNT exceptions # i.e. is enabled structured async WinNT exceptions