X-Loop: help-debbugs@HIDDEN Subject: bug#15793: Bug: linking shared libraries on Cygwin results in undefined references to __stack_chck_guard for code compiled with -fstack-protector Resent-From: Richard PALO <richard.palo@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-libtool@HIDDEN Resent-Date: Sat, 02 Nov 2013 23:16:01 +0000 Resent-Message-ID: <handler.15793.B.13834341328270 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 15793 X-GNU-PR-Package: libtool X-GNU-PR-Keywords: To: 15793 <at> debbugs.gnu.org Cc: libtool-patches@HIDDEN X-Debbugs-Original-To: bug-libtool@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.13834341328270 (code B ref -1); Sat, 02 Nov 2013 23:16:01 +0000 Received: (at submit) by debbugs.gnu.org; 2 Nov 2013 23:15:32 +0000 Received: from localhost ([127.0.0.1]:60140 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1VckPj-00029J-Qq for submit <at> debbugs.gnu.org; Sat, 02 Nov 2013 19:15:32 -0400 Received: from eggs.gnu.org ([208.118.235.92]:48166) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from <gnu-bug-libtool@HIDDEN>) id 1Vck6O-0001e9-Co for submit <at> debbugs.gnu.org; Sat, 02 Nov 2013 18:55:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <gnu-bug-libtool@HIDDEN>) id 1Vck6C-0003Py-Fr for submit <at> debbugs.gnu.org; Sat, 02 Nov 2013 18:55:26 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:49486) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <gnu-bug-libtool@HIDDEN>) id 1Vck6C-0003Pu-CM for submit <at> debbugs.gnu.org; Sat, 02 Nov 2013 18:55:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49870) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <gnu-bug-libtool@HIDDEN>) id 1Vck66-0008Jp-Ei for bug-libtool@HIDDEN; Sat, 02 Nov 2013 18:55:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <gnu-bug-libtool@HIDDEN>) id 1Vck5x-0003L6-O8 for bug-libtool@HIDDEN; Sat, 02 Nov 2013 18:55:14 -0400 Received: from plane.gmane.org ([80.91.229.3]:37513) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <gnu-bug-libtool@HIDDEN>) id 1Vck5x-0003GE-Hs for bug-libtool@HIDDEN; Sat, 02 Nov 2013 18:55:05 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from <gnu-bug-libtool@HIDDEN>) id 1Vck5v-0005TY-2I for bug-libtool@HIDDEN; Sat, 02 Nov 2013 23:55:03 +0100 Received: from pig83-1-78-228-114-66.fbx.proxad.net ([78.228.114.66]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for <bug-libtool@HIDDEN>; Sat, 02 Nov 2013 23:55:03 +0100 Received: from richard.palo by pig83-1-78-228-114-66.fbx.proxad.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for <bug-libtool@HIDDEN>; Sat, 02 Nov 2013 23:55:03 +0100 X-Injected-Via-Gmane: http://gmane.org/ From: Richard PALO <richard.palo@HIDDEN> Date: Sat, 02 Nov 2013 23:45:29 +0100 Lines: 30 Message-ID: <l53v9v$gjn$1@HIDDEN> References: <AANLkTimBUMzojnf9RAqAowJGGG_B8c8o-R5Aq9bjWvYs@HIDDEN> <20100601222415.23d4ea46@YAAKOV04> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@HIDDEN X-Gmane-NNTP-Posting-Host: pig83-1-78-228-114-66.fbx.proxad.net User-Agent: Mozilla/5.0 (X11; SunOS i86pc; rv:24.0) Gecko/20100101 Thunderbird/24.0.1 In-Reply-To: <20100601222415.23d4ea46@YAAKOV04> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.1 (----) X-Mailman-Approved-At: Sat, 02 Nov 2013 19:15:30 -0400 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -4.1 (----) Le 02/06/10 05:24, Yaakov (Cygwin/X) a écrit : > On Sat, 15 May 2010 09:07:49 +0200 > Bart Van Assche <bvanassche@HIDDEN> wrote: >> This behavior has been observed with libtool version 2.2.6. > > Bug confirmed. When code is compiled with -fstack-protector{,-all}, > GCC "emits extra code to check for buffer overflows, such as stack > smashing attacks". This extra code uses symbols from libssp, and > therefore (at least) Cygwin's GCC specs contain: > > *link_ssp: > %{fstack-protector|fstack-protector-all:-lssp_nonshared -lssp} > > Therefore, when libtool fails to pass -fstack-protector{,-all} at link > stage, the link fails. > > Patch attached. (Yes, I have a copyright assignment on file.) > > > Yaakov > Cygwin/X > I've done some limited testing of this patch on a SunOS distro with pkgsrc, and it certainly helps a number of cases since it is gcc that generates the necessary '-lssp_nonshared -lssp' libs for linking (at least in absence of '-nostdlib'). Please include in the upcoming version.
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Richard PALO <richard.palo@HIDDEN> Subject: bug#15793: Acknowledgement (Bug: linking shared libraries on Cygwin results in undefined references to __stack_chck_guard for code compiled with -fstack-protector) Message-ID: <handler.15793.B.13834341328270.ack <at> debbugs.gnu.org> References: <l53v9v$gjn$1@HIDDEN> X-Gnu-PR-Message: ack 15793 X-Gnu-PR-Package: libtool Reply-To: 15793 <at> debbugs.gnu.org Date: Sat, 02 Nov 2013 23:16:02 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-libtool@HIDDEN If you wish to submit further information on this problem, please send it to 15793 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 15793: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D15793 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
X-Loop: help-debbugs@HIDDEN Subject: bug#15793: Bug: linking shared libraries on Cygwin results in undefined references to __stack_chck_guard for code compiled with -fstack-protector Resent-From: Richard PALO <richard@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-libtool@HIDDEN Resent-Date: Thu, 24 Sep 2015 16:47:01 +0000 Resent-Message-ID: <handler.15793.B.144311316422544 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 15793 X-GNU-PR-Package: libtool X-GNU-PR-Keywords: To: libtool-patches@HIDDEN Cc: 15793 <at> debbugs.gnu.org X-Debbugs-Original-Cc: bug-libtool@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.144311316422544 (code B ref -1); Thu, 24 Sep 2015 16:47:01 +0000 Received: (at submit) by debbugs.gnu.org; 24 Sep 2015 16:46:04 +0000 Received: from localhost ([127.0.0.1]:42010 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1Zf9el-0005rI-NI for submit <at> debbugs.gnu.org; Thu, 24 Sep 2015 12:46:04 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53802) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from <richard@HIDDEN>) id 1Zf6OA-0000o7-PQ for submit <at> debbugs.gnu.org; Thu, 24 Sep 2015 09:16:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <richard@HIDDEN>) id 1Zf6O9-0003p0-Im for submit <at> debbugs.gnu.org; Thu, 24 Sep 2015 09:16:42 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:44775) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <richard@HIDDEN>) id 1Zf6O9-0003ot-GP for submit <at> debbugs.gnu.org; Thu, 24 Sep 2015 09:16:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35551) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <richard@HIDDEN>) id 1Zf6O8-0000hm-6e for bug-libtool@HIDDEN; Thu, 24 Sep 2015 09:16:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <richard@HIDDEN>) id 1Zf6O4-0003mU-0a for bug-libtool@HIDDEN; Thu, 24 Sep 2015 09:16:40 -0400 Received: from smtp2-g21.free.fr ([2a01:e0c:1:1599::11]:58568) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <richard@HIDDEN>) id 1Zf6O3-0003kG-QT; Thu, 24 Sep 2015 09:16:35 -0400 Received: from [192.168.0.6] (unknown [78.228.114.66]) (Authenticated sender: richard.palo) by smtp2-g21.free.fr (Postfix) with ESMTPSA id D72564B0089; Thu, 24 Sep 2015 15:16:29 +0200 (CEST) Message-ID: <5603F78D.4060202@HIDDEN> Date: Thu, 24 Sep 2015 15:15:57 +0200 From: Richard PALO <richard@HIDDEN> User-Agent: Mozilla/5.0 (X11; SunOS i86pc; rv:) Gecko/20100101 Thunderbird/24.8.1 MIME-Version: 1.0 Newsgroups: gmane.comp.gnu.libtool.patches,gmane.comp.gnu.libtool.bugs References: <AANLkTimBUMzojnf9RAqAowJGGG_B8c8o-R5Aq9bjWvYs@HIDDEN> <20100601222415.23d4ea46@YAAKOV04> <l53v9v$gjn$1@HIDDEN> In-Reply-To: <l53v9v$gjn$1@HIDDEN> Content-Type: multipart/mixed; boundary="------------010200060800090705000308" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Mailman-Approved-At: Thu, 24 Sep 2015 12:46:01 -0400 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -5.0 (-----) This is a multi-part message in MIME format. --------------010200060800090705000308 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Le 02/11/13 23:45, Richard PALO a =C3=A9crit : > Le 02/06/10 05:24, Yaakov (Cygwin/X) a =C3=A9crit : >> On Sat, 15 May 2010 09:07:49 +0200 >> Bart Van Assche <bvanassche@HIDDEN> wrote: >>> This behavior has been observed with libtool version 2.2.6. >> >> Bug confirmed. When code is compiled with -fstack-protector{,-all}, >> GCC "emits extra code to check for buffer overflows, such as stack >> smashing attacks". This extra code uses symbols from libssp, and >> therefore (at least) Cygwin's GCC specs contain: >> >> *link_ssp: >> %{fstack-protector|fstack-protector-all:-lssp_nonshared -lssp} >> >> Therefore, when libtool fails to pass -fstack-protector{,-all} at link >> stage, the link fails. >> >> Patch attached. (Yes, I have a copyright assignment on file.) >> >> >> Yaakov >> Cygwin/X >> >=20 > I've done some limited testing of this patch on a SunOS distro with=20 > pkgsrc, and it certainly helps a number of cases since it is gcc that=20 > generates the necessary '-lssp_nonshared -lssp' libs for linking (at=20 > least in absence of '-nostdlib'). >=20 > Please include in the upcoming version. >=20 >=20 >=20 >=20 I'd like to propose a slight modification this which, in addition, seems = to get over the issue (at least on solaris) of c++ shared libraries linking '-nostdlib'. = =20 This could easily be adapted for other hosts using g++. Note, it is harml= ess if '-dumpspecs' or no spec with fstack-protector* is available. It appears there was no warm welcome in tossing the '-nostdlib' setup for= g++ shared libraries=20 for solaris, so this seems to be a reasonable workaround. --=20 Richard PALO --------------010200060800090705000308 Content-Type: text/x-patch; name="0001-workaround-for-nostdlib-with-fstack-protector-on-sol.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-workaround-for-nostdlib-with-fstack-protector-on-sol.pa"; filename*1="tch" From 5dfcf84c8243441f30a3c852791b8d46bc4d2c53 Mon Sep 17 00:00:00 2001 From: Richard PALO <richard@HIDDEN> Date: Thu, 24 Sep 2015 13:23:56 +0200 Subject: [PATCH] workaround for -nostdlib with -fstack-protector on solaris --- build-aux/ltmain.in | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in index 0c40da0..7a6356b 100644 --- a/build-aux/ltmain.in +++ b/build-aux/ltmain.in @@ -5364,8 +5364,7 @@ func_mode_link () # -stdlib=* select c++ std lib with clang -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ - -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ - -specs=*) + -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-stdlib=*|-specs=*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result func_append compile_command " $arg" @@ -5374,6 +5373,25 @@ func_mode_link () continue ;; + -fstack-protector*) + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result + func_append compile_command " $arg" + func_append finalize_command " $arg" + func_append compiler_flags " $arg" + + # Explicitly add solaris ssp libs to postdeps to counter + # linking with g++ -nostdlib when supplied -fstack-protector* + test CXX = "$tagname" && { + case $host_os in + solaris*) + func_append postdeps " `$compile_command -dumpspecs 2>/dev/null | $SED -n '/fstack-protector/{s/^.*://;s/}$//;p;}'`" + ;; + esac + } + continue + ;; + -Z*) if test os2 = "`expr $host : '.*\(os2\)'`"; then # OS/2 uses -Zxxx to specify OS/2-specific options -- 2.5.2 --------------010200060800090705000308--
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.