Skip to content

Commit 8aa160a

Browse files
committed
Back-port binutils patch: Don't define _FORTIFY_SOURCE on MinGW
ref. https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=5f23a08201ed01570b34f5cff99a95fc7b9e2fdb > Don't define _FORTIFY_SOURCE on MinGW > > Recent MinGW versions require -lssp when using _FORTIFY_SOURCE, which > gdb does (in common-defs.h) > msys2/MINGW-packages#5868 (comment) > To avoid all the complications with checking for -lssp and making sure it's > linked statically, just don't define it.
1 parent 78d81d7 commit 8aa160a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

patches/bin-002-fortify-source.patch

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
diff --git a/gdb/common/common-defs.h b/gdb/common/common-defs.h
2+
index 88b05ef723c..214bca1ee17 100644
3+
--- a/gdb/common/common-defs.h
4+
+++ b/gdb/common/common-defs.h
5+
@@ -66,9 +66,13 @@
6+
plus this seems like a reasonable safety measure. The check for
7+
optimization is required because _FORTIFY_SOURCE only works when
8+
optimization is enabled. If _FORTIFY_SOURCE is already defined,
9+
- then we don't do anything. */
10+
+ then we don't do anything. Also, on MinGW, fortify requires
11+
+ linking to -lssp, and to avoid the hassle of checking for
12+
+ that and linking to it statically, we just don't define
13+
+ _FORTIFY_SOURCE there. */
14+
15+
-#if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__ > 0
16+
+#if (!defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__ > 0 \
17+
+ && !defined(__MINGW32__))
18+
#define _FORTIFY_SOURCE 2
19+
#endif

0 commit comments

Comments
 (0)