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:
richard@devzone:/var/tmp/pkgsrc/graphics/graphviz/work/graphviz-2.38.0/tclpkg/gv/.libs$
ldd -D libgv_perl.so
libgvc.so.6 =>
/var/tmp/pkgsrc/graphics/graphviz/work/graphviz-2.38.0/lib/gvc/.libs/libgvc.so.6
libcgraph.so.6 => /opt/local/lib/libcgraph.so.6
libcdt.so.5 => /opt/local/lib/libcdt.so.5
libdl.so.1 => /lib/libdl.so.1
libltdl.so.7 => /opt/local/lib/libltdl.so.7
libxdot.so.4 => /opt/local/lib/libxdot.so.4
libpathplan.so.4 => /opt/local/lib/libpathplan.so.4
libexpat.so.1 => /opt/local/lib/libexpat.so.1
libpthread.so.1 => /lib/libpthread.so.1
librt.so.1 => /lib/librt.so.1
libsocket.so.1 => /lib/libsocket.so.1
libnsl.so.1 => /lib/libnsl.so.1
libz.so.1 => /opt/local/lib/libz.so.1
libm.so.2 => /lib/libm.so.2
libperl.so =>
/opt/local/lib/perl5/5.20.0/i386-solaris/CORE/libperl.so
libstdc++.so.6 =>
/opt/local/gcc47/i386-sun-solaris2.11/lib/./libstdc++.so.6
libgcc_s.so.1 =>
/opt/local/gcc47/i386-sun-solaris2.11/lib/./libgcc_s.so.1
libc.so.1 => /lib/libc.so.1
libssp.so.0 =>
/opt/local/gcc47/i386-sun-solaris2.11/lib/./libssp.so.0
<<<<<<<<<<<<<<<<<<<<<<<<<
libmp.so.2 => /lib/libmp.so.2
libmd.so.1 => /lib/libmd.so.1
richard@devzone:/var/tmp/pkgsrc/graphics/graphviz/work/graphviz-2.38.0/tclpkg/gv/.libs$
nm libgv_perl.so |grep __stack
[680] | 0| 0|FUNC |GLOB |0 |UNDEF
|__stack_chk_fail
[47] | 83792| 29|FUNC |LOCL |2 |14
|__stack_chk_fail_local
[684] | 0| 0|OBJT |GLOB |0 |UNDEF
|__stack_chk_guard
Even though on Solaris libssp_unshared.o is no longer needed, libssp.so
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?