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 06/04/14 15:21, Joerg Sonnenberger a écrit :
On Tue, Apr 01, 2014 at 07:02:22AM +0200, Richard PALO wrote:
   permits libtool to generate -fstack-protector* on all platforms.

*sigh* Stupid, stupid, crappy specs. I dislike this. A lot. It should
never have become a spec modifier. Is this for broken GCC instances
outside pkgsrc or for the versions we have some control over?

Well, this patch only prevents libtool invoked with '--mode=link' from suppressing '-fstack-protector*' allowing the flag to be passed through unchanged to gcc/link where it will 'do the right thing'.

In particular, for SunOS, this permits gcc to add the following to the link statement: '-lssp_nonshared -lssp'.

I should reiterate that although this is sufficient for gcc, for g++ 0003-remove-nostdlib-from-libtool-shared-libraries-for-fs.patch is needed as well in order to prevent g++ from consequently stripping via '-nostdlib' what it should be adding.

To answer your question, this particular patch (0001) is solely a libtool patch, which works with both native and pkgsrc gcc/g++.

In theory, and in my testing thus far on SunOS, this should simplify pkgsrc as opposed to complicate it given libtool won't swallow any longer the '-fstack-protector*' flag (which affected at very least perl and cups).

   affects only SunOS x86_64 libtool, gcc47 & gcc48

I believe the correct fix is the same I am going to apply for NetBSD
soon -- to just not include GCC's unwinder in libgcc_s.

I'm not so sure, as this is the equivalent of the upstream gcc *and* libtool patch.

Here is the commit message for libtool:
commit 525cddd2bcea4c565d6dd1d2d55dd1de1a476b67
Author: Rainer Orth <ro%CeBiTec.Uni-Bielefeld.DE@localhost>
Date:   Sat Jan 18 10:07:52 2014 +1300

    libtool: opt_duplicate_compiler_generated_deps is harmful on Solaris

    Fix for
    * build-aux/ (libtool_validate_options): disable the
    opt_duplicate_compiler_generated_deps optimization for Solaris2 so
    that gcc-4.9+ compiled C++ code with -Wl,-Bdirect on 64-bit Solaris
    x86 can avoid unwinding failures caused by accidental mixing of the
    libc and libgcc_s unwinders in a single executable.

    Signed-off-by: Gary V. Vaughan <>

A link to the gcc bugreports is indicated in the patchset as well.
Again, this patcheset only affects SunOS platforms (gcc* and libtool).



Home | Main Index | Thread Index | Old Index