static non-SSP'ed executable linked with SSP'ed library

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

 



Hi list,

(Please Cc: me when replying, I am not subscribed.  Thank you.)

First, I am not sure this is the correct list to ask this, but I don't
know a more relevant place.  Feel free to redirect me but don't blame me,
please.  Also, I am not looking for flame war, I just want technical
informations.

I am integrating ProPolice into FreeBSD.  Given that FreeBSD sources
do not build with GCC 4 yet, I used Hiroaki Etoh's patch.  But this
is just the background, not the exact point of my email.

For various reasons, I wanted to have SSP symbols (__guard and
__stack_smash_handler) into a separate libssp.  After many fiddling
to get FreeBSD to build completely, I have ran into the problem
described below.  Likewise GCC 4.1 provides a libssp, thus I am
sure that GCC 4.1 users did or will stumble on this too.

Imagine that I want to build a static binary without turning on
the SSP stuff, but meanwhile I want to link it against a static
library (say, libz.a) which IS SSP-protected and therefore requires
SSP symbols.
I tuned GCC configuration to make it link against libssp only when
-fstack-protector is used.  In this case, this option is not used
and therefore the link will obviously fail because of the lack
of SSP symbols required to satisfy the SSP'ed libz.a.

This doesn't happen in the dynamic case because shared objects can
depend on other shared objects (IOW, libz.so depends on libssp.so).

I would like to avoid breaking the principle of least astonishment as
much as possible and thus make it as transparent as possible to the
end user.

Here are the possible alternatives I thought about in order to satisfy
the static case.  I would like to know which is the wisest :
    - pull in libssp's symbols in libc.a ;
    - have GCC always link against libssp in the static case ;

Thank you in advance for you answers.
Best regards,
-- 
Jeremie Le Hen
< jeremie at le-hen dot org >< ttz at chchile dot org >

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux