Don't define _FORTIFY_SOURCE on MinGW
[deliverable/binutils-gdb.git] / gdb / gdbsupport / common-defs.h
index 88b05ef723c6d609a1eeb964381687d73d6e355e..214bca1ee17e10d22b73143c641f0c03df10003e 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.023306 seconds and 4 git commands to generate.