mk: workaround for mingw stack-protector bug
Add -mstack-protector-guard=global to work around GCC bug 86832, where -fstack-protector will attempt to use native TLS, but mingw only supports emulated TLS. This causes a segmentation violation at the start of any function protected by stack-protector. The issue exists in GCC versions prior to 8.3. Enable -mstack-protector-guard=global which uses a global variable for the guard value. This is the behaviour with the fix, so there is no downside to enabling it for all versions of GCC on Windows. Signed-off-by: Nick Connolly <nick.connolly@mayadata.io> Change-Id: I85bc831043585071b0d8b0a3dd637b8d9ff26dab Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6575 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Mellanox Build Bot Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
parent
af17c1d44d
commit
3399171388
@ -129,6 +129,11 @@ COMMON_CFLAGS += -fPIC
|
||||
# Enable stack buffer overflow checking
|
||||
COMMON_CFLAGS += -fstack-protector
|
||||
|
||||
ifeq ($(OS).$(CC_TYPE),Windows.gcc)
|
||||
# Workaround for gcc bug 86832 - invalid TLS usage
|
||||
COMMON_CFLAGS += -mstack-protector-guard=global
|
||||
endif
|
||||
|
||||
# Prevent accidental multiple definitions of global variables
|
||||
COMMON_CFLAGS += -fno-common
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user