Changeset - r23976:dd7d2c685eb3
[Not reviewed]
master
0 1 0
glx - 5 years ago 2019-12-14 18:08:30
glx@openttd.org
Fix: [MinGW] undefined references when _FORTIFY_SOURCE > 0
1 file changed with 8 insertions and 0 deletions:
0 comments (0 inline, 0 general)
config.lib
Show inline comments
 
@@ -1513,18 +1513,26 @@ make_cflags_and_ldflags() {
 
		cc_host_is_gcc=`basename "$cc_host" | grep "gcc" 2>/dev/null`
 
		if [ -n "$cc_host_is_gcc" ]; then
 
			# Define only when compiling with GCC. Some GLIBC versions use GNU
 
			# 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
 

	
 
	if [ "$os" = "OSX" ] && [ $cc_version -eq 400 ]; then
 
		# Apple's GCC 4.0 has a compiler bug for x86_64 with (higher) optimization,
 
		# wrongly optimizing ^= in loops. This disables the failing optimisation.
0 comments (0 inline, 0 general)