From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 89268 invoked by alias); 18 Dec 2019 18:23:58 -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 89260 invoked by uid 89); 18 Dec 2019 18:23:58 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-28.3 required=5.0 tests=AWL,BAYES_00,ENV_AND_HDR_SPF_MATCH,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,RCVD_IN_JMF_BL,SPF_PASS,USER_IN_DEF_SPF_WL autolearn=ham version=3.3.1 spammy= X-HELO: mail-oi1-f193.google.com Received: from mail-oi1-f193.google.com (HELO mail-oi1-f193.google.com) (209.85.167.193) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 18 Dec 2019 18:23:56 +0000 Received: by mail-oi1-f193.google.com with SMTP id i1so1575963oie.8 for ; Wed, 18 Dec 2019 10:23:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=ACWQtCWhrRETbCjpwic2AG6S/3U9qx9NBt64hryV9Nw=; b=L+NSg8wcujHSuS+CpQNYR74sfiPHK7e4bAzeeDokEqr+0VYWifYSs7MVw/8YalVtn9 oQumrsm62O58QpvLbfaumkS0F7Q2K9hiuVrMzY+u+5AT9CHS6oOGP7kpKlBxJa3vp7E1 ROByiWKxDE67DNP+irqbUOTAk/++Rv4Xkarm8zrp4aBZhyaqVI0vG2+VwoOdETGt2weK cwgpW4l54sAKNgl8WZsjVzNSicafkqpAh1P7SUK9IzClZwV2sj16sjxZjUe+uc/93RCr MGvn58j8sPfAmjqqhMdYzSZ96bxx1oMSrhx2/M7yn2okTIYoIy4ygOU16tmr/oIjoaU6 iwew== MIME-Version: 1.0 References: <20191218181413.128412-1-cbiesinger@google.com> In-Reply-To: <20191218181413.128412-1-cbiesinger@google.com> From: "Christian Biesinger via gdb-patches" Reply-To: Christian Biesinger Date: Wed, 18 Dec 2019 18:23:00 -0000 Message-ID: Subject: Re: [PATCH] Link to -lssp when available (fixes mingw build) To: gdb-patches Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2019-12/txt/msg00779.txt.bz2 On Wed, Dec 18, 2019 at 12:14 PM Christian Biesinger wrote: > > 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 I should have clarified: this is mingw64 (from msys2.org). Also, I'd like to push this to the gdb 9 branch too, if that's ok. Christian > 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 >