summaryrefslogtreecommitdiff
path: root/config.lib
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2019-12-14 19:08:30 +0100
committerNiels Martin Hansen <nielsm@indvikleren.dk>2019-12-21 20:13:28 +0100
commitfaaec445d669a222718c2634eb059c44c00a43b7 (patch)
tree440dfa60fb64102fa3e877e7f82d9f6631936dac /config.lib
parente3c75a30bac6837c0a525aa58d2b966eb232650f (diff)
downloadopenttd-faaec445d669a222718c2634eb059c44c00a43b7.tar.xz
Fix: [MinGW] undefined references when _FORTIFY_SOURCE > 0
Diffstat (limited to 'config.lib')
-rw-r--r--config.lib8
1 files changed, 8 insertions, 0 deletions
diff --git a/config.lib b/config.lib
index a7df13576..df3b23fed 100644
--- a/config.lib
+++ b/config.lib
@@ -1516,12 +1516,20 @@ make_cflags_and_ldflags() {
# extensions in a way that breaks build with at least ICC.
# This requires -O1 or more, so debug level 3 (-O0) is excluded.
CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
+ if [ "$os" = "MINGW" ]; then
+ # Prevent undefined references when _FORTIFY_SOURCE > 0
+ LDFLAGS="$LDFLAGS -fstack-protector"
+ fi
fi
cc_build_is_gcc=`basename "$cc_build" | grep "gcc" 2>/dev/null`
if [ -n "$cc_build_is_gcc" ]; then
# Just add -O1 to the tools needed for building.
CFLAGS_BUILD="$CFLAGS_BUILD -D_FORTIFY_SOURCE=2 -O1"
+ if [ "$os" = "MINGW" ]; then
+ # Prevent undefined references when _FORTIFY_SOURCE > 0
+ LDFLAGS_BUILD="$LDFLAGS_BUILD -fstack-protector"
+ fi
fi
fi