tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: libtool, -fstack-protector, -nostdlib, and while we're at it -Bdirect on SunOS



Le 01/04/14 07:02, Richard PALO a écrit :
In order to get over suppression of -fstack-protector namely in SunOS
builds for perl and cups, I've been testing for a real long time now
a patch found on libtool-patches@ in the following thread:
Re: Bug: linking shared libraries on Cygwin results in undefined
references to __stack_chck_guard for code compiled with -fstack-protector

This patch prevents libtools link phase from suppressing
'-fstack-protector*' switches such that gcc can issue the proper link
statement.

Well, that was fine for gcc, but when building with g++ libtool adds for
some reason '-nostdlib' which foils the above patch, so that needed
attending to.  It is useful to know that this patch fixes similar
problems with, for example, '-pthread' and others!

Then, Mr Orth found a problem on SunOS x86_64 with -Bdirect as mentioned
here: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452 and
  http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788

So I have some patches found here:
http://www.netbsd.org/~richard/libtool-SunOS/ that I've been using
without issue on both i386 and x86_64.

Summary:

0001-add-fstack-protector-link-support-to-libtool.patch
   permits libtool to generate -fstack-protector* on all platforms.

0002-x86-64-sunos-fix-for-g-and-Wl-Bdirect-involving-libt.patch
   affects only SunOS x86_64 libtool, gcc47 & gcc48

0003-remove-nostdlib-from-libtool-shared-libraries-for-fs.patch
   suppresses -nostdlib with g++ on SunOS only  (see note # below)

0004-use-libtool-fstack-protector-support-in-cups.patch
   re-enable in perl

0005-put-back-stack-protector-on-solaris-in-perl.patch
   re-enable in perl

Note # other platforms that wish to test suppression of '-nostdlib' will
need to apply a similar patch for their target.  Apparently
the darwin platform may have (or have had) issues...

I encourage direct participation in the libtool@ discussion
'g++ and -nostdlib'

NB libtool-base is *not* revbump'd in the any of the above patches,
although gcc*, cups, and perl are.


If there is no motivated objection, I plan on pushing this early may.

Again, for non SunOS platforms, the only effect is to see libtool pass through '-fstack-protector*' for gcc with mode=link having been suppressed up to now.

For SunOS, '-fstack-protector*' will now work for both gcc/g++ as well as picking up an fix for '-Wl,-Bdirect' when using either gcc47 or gcc48 and should be ready now for upstream gcc49.



Home | Main Index | Thread Index | Old Index