From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 78332 invoked by alias); 18 Dec 2019 18:14:20 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 78322 invoked by uid 89); 18 Dec 2019 18:14:20 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.8 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=3710 X-HELO: mail-yw1-f74.google.com Received: from mail-yw1-f74.google.com (HELO mail-yw1-f74.google.com) (209.85.161.74) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 18 Dec 2019 18:14:18 +0000 Received: by mail-yw1-f74.google.com with SMTP id o1so1962372ywl.1 for ; Wed, 18 Dec 2019 10:14:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=1tE375bYRnEXyBE0KstpAyRvYlM84zB4QiEzu2jAfY8=; b=X4R+L4kolh2H/Tce051PPaBh8v6y9ig99VsKUTJwNU54ajtr+hlAxUBleSY6MRsbpz D2OkZWplDunbxuF3jemmT8kiA5QijY63RknJYbI2sSWg8JDWP0n/3pWoakMz/SLl/Iws 30R3RC4tfR7oOQjmCilj0sVKRsBjwzLY+wUGkQlvXH7Kct2TqaMuB3fb65W4oIm5U9h/ diSF6SXhD44DEvE0Yl9pUK0+fNQMFMP+1/G2UAfjqyg8VGKiF4x1BUoLkrqMr87B4nE6 cKn/3xIXdy3KkIIbSoyrW1n/9a3obgogF7etZQVxiSCC9CuFHgP+m4C12/spSLDi1N4F SAwA== Date: Wed, 18 Dec 2019 18:14:00 -0000 Message-Id: <20191218181413.128412-1-cbiesinger@google.com> Mime-Version: 1.0 Subject: [PATCH] Link to -lssp when available (fixes mingw build) From: "Christian Biesinger via gdb-patches" Reply-To: Christian Biesinger To: gdb-patches@sourceware.org Cc: Christian Biesinger Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2019-12/txt/msg00778.txt.bz2 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 * configure: Regenerate. * gdbsupport/common.m4: Look for -lssp to fix mingw. gdb/gdbserver/ChangeLog: 2019-12-18 Christian Biesinger * 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