diff options
author | kan <kan@FreeBSD.org> | 2009-06-28 23:51:39 +0000 |
---|---|---|
committer | kan <kan@FreeBSD.org> | 2009-06-28 23:51:39 +0000 |
commit | f780ef8f1980f918f04365b9374ef3f0b5c8652b (patch) | |
tree | 601ae0a8f92e47fd15b2574968520ee80c372d0e /gnu/usr.bin/cc | |
parent | 54f24c117ae26fcfb1000a0fe7ab5f376997f7f6 (diff) | |
download | FreeBSD-src-f780ef8f1980f918f04365b9374ef3f0b5c8652b.zip FreeBSD-src-f780ef8f1980f918f04365b9374ef3f0b5c8652b.tar.gz |
Eliminate .text relocations in shared libraries compiled with stack protector.
Use libssp_nonshared library to pull __stack_chk_fail_local symbol into
each library that needs it instead of pulling it from libc. GCC generates
local calls to this function which result in absolute relocations put into
position-independent code segment, making dynamic loader do extra work everys
time given shared library is being relocated and making affected text pages
non-shareable.
Reviewed by: kib
Approved by: re (kensmith)
Diffstat (limited to 'gnu/usr.bin/cc')
-rw-r--r-- | gnu/usr.bin/cc/cc_tools/freebsd-native.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gnu/usr.bin/cc/cc_tools/freebsd-native.h b/gnu/usr.bin/cc/cc_tools/freebsd-native.h index 6f7fd7b..b9ddea1 100644 --- a/gnu/usr.bin/cc/cc_tools/freebsd-native.h +++ b/gnu/usr.bin/cc/cc_tools/freebsd-native.h @@ -62,3 +62,11 @@ /* FreeBSD is 4.4BSD derived */ #define bsd4_4 + +/* + * Link in libssp_nonshared to get local hidden symbol for + * __stack_chk_fail_local into each binary that needs it. + * Linux does this with static part of their libc.so linker script, we reuse + * libssp_nonshared.a for the same purpose. + */ +#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all:-lssp_nonshared}" |