public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Link to -lssp when available (fixes mingw build)
@ 2019-12-18 18:14 Christian Biesinger via gdb-patches
  2019-12-18 18:23 ` Christian Biesinger via gdb-patches
  2019-12-18 18:45 ` Eli Zaretskii
  0 siblings, 2 replies; 25+ messages in thread
From: Christian Biesinger via gdb-patches @ 2019-12-18 18:14 UTC (permalink / raw)
  To: gdb-patches; +Cc: Christian Biesinger

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

gdb/ChangeLog:

2019-12-18  Christian Biesinger  <cbiesinger@google.com>

	* configure: Regenerate.
	* gdbsupport/common.m4: Look for -lssp to fix mingw.

gdb/gdbserver/ChangeLog:

2019-12-18  Christian Biesinger  <cbiesinger@google.com>

	* configure: Regenerate.

Change-Id: Ide6870ab57198219a2ef78bc675768a789ca2b1d
---
 gdb/configure            | 57 ++++++++++++++++++++++++++++++++++++++++
 gdb/gdbserver/configure  | 57 ++++++++++++++++++++++++++++++++++++++++
 gdb/gdbsupport/common.m4 |  4 +++
 3 files changed, 118 insertions(+)

diff --git a/gdb/configure b/gdb/configure
index 324eb50944..04ead07bc9 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -13642,6 +13642,63 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing __memcpy_chk" >&5
+$as_echo_n "checking for library containing __memcpy_chk... " >&6; }
+if ${ac_cv_search___memcpy_chk+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char __memcpy_chk ();
+int
+main ()
+{
+return __memcpy_chk ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' ssp; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search___memcpy_chk=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search___memcpy_chk+:} false; then :
+  break
+fi
+done
+if ${ac_cv_search___memcpy_chk+:} false; then :
+
+else
+  ac_cv_search___memcpy_chk=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search___memcpy_chk" >&5
+$as_echo "$ac_cv_search___memcpy_chk" >&6; }
+ac_res=$ac_cv_search___memcpy_chk
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+
   # Check for std::thread.  This does not work on some platforms, like
   # mingw and DJGPP.
   ac_ext=cpp
diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
index ccffde80ed..9f1cc70fda 100755
--- a/gdb/gdbserver/configure
+++ b/gdb/gdbserver/configure
@@ -7034,6 +7034,63 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing __memcpy_chk" >&5
+$as_echo_n "checking for library containing __memcpy_chk... " >&6; }
+if ${ac_cv_search___memcpy_chk+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char __memcpy_chk ();
+int
+main ()
+{
+return __memcpy_chk ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' ssp; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search___memcpy_chk=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search___memcpy_chk+:} false; then :
+  break
+fi
+done
+if ${ac_cv_search___memcpy_chk+:} false; then :
+
+else
+  ac_cv_search___memcpy_chk=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search___memcpy_chk" >&5
+$as_echo "$ac_cv_search___memcpy_chk" >&6; }
+ac_res=$ac_cv_search___memcpy_chk
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+
   # Check for std::thread.  This does not work on some platforms, like
   # mingw and DJGPP.
   ac_ext=cpp
diff --git a/gdb/gdbsupport/common.m4 b/gdb/gdbsupport/common.m4
index c61753fb8e..eb66ec3731 100644
--- a/gdb/gdbsupport/common.m4
+++ b/gdb/gdbsupport/common.m4
@@ -37,6 +37,10 @@ AC_DEFUN([GDB_AC_COMMON], [
 
   AC_CHECK_DECLS([strstr])
 
+  dnl Recent mingw requires -lssp when using _FORTIFY_SOURCE, which we do
+  dnl (see gdbsupport/common-defs.h)
+  AC_SEARCH_LIBS(__memcpy_chk, ssp)
+
   # Check for std::thread.  This does not work on some platforms, like
   # mingw and DJGPP.
   AC_LANG_PUSH([C++])
-- 
2.24.1.735.g03f4e72817-goog

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2020-02-15 14:06 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-18 18:14 [PATCH] Link to -lssp when available (fixes mingw build) Christian Biesinger via gdb-patches
2019-12-18 18:23 ` Christian Biesinger via gdb-patches
2019-12-18 18:45 ` Eli Zaretskii
2019-12-18 18:57   ` Christian Biesinger via gdb-patches
2019-12-18 19:07     ` [PATCH v2] Don't define _FORTIFY_SOURCE on mingw Christian Biesinger via gdb-patches
2020-01-02 11:31       ` Joel Brobecker
2020-01-07 23:43         ` Christian Biesinger via gdb-patches
2020-01-08  3:30           ` Eli Zaretskii
2020-01-09 22:23           ` Tom Tromey
2020-01-09 22:32             ` Christian Biesinger via gdb-patches
2020-01-10  0:28               ` Tom Tromey
2020-01-10 17:41                 ` Christian Biesinger via gdb-patches
2019-12-18 19:08     ` [PATCH] Link to -lssp when available (fixes mingw build) Eli Zaretskii
2019-12-18 19:12       ` Christian Biesinger via gdb-patches
2019-12-18 19:40         ` Eli Zaretskii
2019-12-18 19:50           ` Christian Biesinger via gdb-patches
2019-12-18 19:57             ` Eli Zaretskii
2019-12-18 20:41               ` Christian Biesinger via gdb-patches
2019-12-18 23:12                 ` Eli Zaretskii
2019-12-18 23:24                   ` Christian Biesinger via gdb-patches
2019-12-19 14:19                     ` Pedro Alves
2019-12-19 15:49                       ` Eli Zaretskii
2020-02-15 14:06                         ` Eli Zaretskii
2019-12-19 20:41                       ` Christian Biesinger via gdb-patches
2019-12-19 15:32                     ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).