GNU bug report logs - #15793
Bug: linking shared libraries on Cygwin results in undefined references to __stack_chck_guard for code compiled with -fstack-protector

Previous Next

Package: libtool;

Reported by: Richard PALO <richard.palo <at> free.fr>

Date: Sat, 2 Nov 2013 23:16:01 UTC

Severity: normal

To reply to this bug, email your comments to 15793 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-libtool <at> gnu.org:
bug#15793; Package libtool. (Sat, 02 Nov 2013 23:16:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Richard PALO <richard.palo <at> free.fr>:
New bug report received and forwarded. Copy sent to bug-libtool <at> gnu.org. (Sat, 02 Nov 2013 23:16:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Richard PALO <richard.palo <at> free.fr>
To: bug-libtool <at> gnu.org
Cc: libtool-patches <at> gnu.org
Subject: Re: Bug: linking shared libraries on Cygwin results in undefined
 references to __stack_chck_guard for code compiled with -fstack-protector
Date: Sat, 02 Nov 2013 23:45:29 +0100
Le 02/06/10 05:24, Yaakov (Cygwin/X) a écrit :
> On Sat, 15 May 2010 09:07:49 +0200
> Bart Van Assche <bvanassche <at> acm.org> 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.






Information forwarded to bug-libtool <at> gnu.org:
bug#15793; Package libtool. (Thu, 24 Sep 2015 16:47:01 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Richard PALO <richard <at> netbsd.org>
To: libtool-patches <at> gnu.org
Cc: bug-libtool <at> gnu.org
Subject: Re: Bug: linking shared libraries on Cygwin results in undefined
 references to __stack_chck_guard for code compiled with -fstack-protector
Date: Thu, 24 Sep 2015 15:15:57 +0200
[Message part 1 (text/plain, inline)]
Le 02/11/13 23:45, Richard PALO a écrit :
> Le 02/06/10 05:24, Yaakov (Cygwin/X) a écrit :
>> On Sat, 15 May 2010 09:07:49 +0200
>> Bart Van Assche <bvanassche <at> acm.org> 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.
> 
> 
> 
> 

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'.  

This could easily be adapted for other hosts using g++. Note, it is harmless 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 
for solaris, so this seems to be a reasonable workaround.

-- 
Richard PALO

[0001-workaround-for-nostdlib-with-fstack-protector-on-sol.patch (text/x-patch, attachment)]

This bug report was last modified 9 years and 322 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.