Don't define _FORTIFY_SOURCE on MinGW
authorChristian Biesinger <cbiesinger@google.com>
Wed, 18 Dec 2019 18:06:43 +0000 (12:06 -0600)
committerChristian Biesinger <cbiesinger@google.com>
Fri, 10 Jan 2020 17:39:38 +0000 (11:39 -0600)
Recent MinGW versions require -lssp when using _FORTIFY_SOURCE, which
gdb does (in common-defs.h)
https://github.com/msys2/MINGW-packages/issues/5868#issuecomment-544107564

To avoid all the complications with checking for -lssp and making sure it's
linked statically, just don't define it.

gdb/ChangeLog:

2020-01-10  Christian Biesinger  <cbiesinger@google.com>

* gdbsupport/common-defs.h: Don't define _FORTIFY_SOURCE on MinGW.

Change-Id: Ide6870ab57198219a2ef78bc675768a789ca2b1d

gdb/ChangeLog
gdb/gdbsupport/common-defs.h

index 4ce7ef447fa36ca80b993f4a936406277aa0b451..dc326f72e9cc5507e218a24cebc8277c8d8509fe 100644 (file)
@@ -1,3 +1,7 @@
+2020-01-10  Christian Biesinger  <cbiesinger@google.com>
+
+       * gdbsupport/common-defs.h: Don't define _FORTIFY_SOURCE on MinGW.
+
 2020-01-07  Tom Tromey  <tromey@adacore.com>
 
        PR build/24937:
index 3225e18226e35e34ff38acb9bf181ced90b2f7f9..710f15dcf180a3c91e0ad20cb9b944027e8046fb 100644 (file)
    plus this seems like a reasonable safety measure.  The check for
    optimization is required because _FORTIFY_SOURCE only works when
    optimization is enabled.  If _FORTIFY_SOURCE is already defined,
-   then we don't do anything.  */
+   then we don't do anything.  Also, on MinGW, fortify requires
+   linking to -lssp, and to avoid the hassle of checking for
+   that and linking to it statically, we just don't define
+   _FORTIFY_SOURCE there.  */
 
-#if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__ > 0
+#if (!defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__ > 0 \
+     && !defined(__MINGW32__))
 #define _FORTIFY_SOURCE 2
 #endif
 
This page took 0.030597 seconds and 4 git commands to generate.