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 10/07/14 22:39, Richard PALO a écrit :
There is one thing that has been bugging me for months is the fact that
(using my test case for graphviz) frequently the need for
'-fstack-protector' comes from a dependant library, such as perl or cups
or something.

That may be fine for programs, but for shared libraries, that can get
quite complicated.

In libtool terms, there is a variable in the .la file named
inherited_linker_flags that is added to the link command to the shared
library...  I guess a reasonably good example of this is '-pthread'.

I believe that '-fstack-protector*' is quite similar in this respect,
and that if '-fstack-protector*' is required to build the shared library
with libtool, then it will be necessary to ultimately link to this new
shared library.

Keeping with my example, note the following:
ldd -D =>
/var/tmp/pkgsrc/graphics/graphviz/work/graphviz-2.38.0/lib/gvc/.libs/ =>     /opt/local/lib/ =>     /opt/local/lib/ =>     /lib/ =>     /opt/local/lib/ =>     /opt/local/lib/ =>     /opt/local/lib/ =>     /opt/local/lib/ =>     /lib/ =>     /lib/ =>     /lib/ =>     /lib/ =>     /opt/local/lib/ =>     /lib/ =>
/opt/local/lib/perl5/5.20.0/i386-solaris/CORE/ =>
/opt/local/gcc47/i386-sun-solaris2.11/lib/./ =>
/opt/local/gcc47/i386-sun-solaris2.11/lib/./ =>     /lib/ =>
<<<<<<<<<<<<<<<<<<<<<<<<< =>     /lib/ =>     /lib/
nm |grep __stack
[680]    |         0|         0|FUNC |GLOB |0    |UNDEF
[47]    |     83792|        29|FUNC |LOCL |2    |14
[684]    |         0|         0|OBJT |GLOB |0    |UNDEF

Even though on Solaris libssp_unshared.o is no longer needed,
still is, and that is provided with the spec '-fstack-protector*'.

So I revived my initial work with "inherited_linker_flags" and attach
the complementary patch for testing prior to pushing patch-ac which is
hereby updated, providing the attached output in the .la file, notably:
# Linker flags that can not go in dependency_libs.
inherited_linker_flags=' -fstack-protector -pthread'

Observations anyone?
I'm closeting [again] this inherited_linker_flags work...
It is moot as any client program needing the ssp libs will have already added necessarily a flavour of '-fstack-protector*'.

+1 to push the lt-refix-update.patch as is.

Home | Main Index | Thread Index | Old Index