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/lib | |
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/lib')
-rw-r--r-- | gnu/lib/libgcc/Makefile | 8 | ||||
-rw-r--r-- | gnu/lib/libssp/libssp_nonshared/Makefile | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/gnu/lib/libgcc/Makefile b/gnu/lib/libgcc/Makefile index 49b96e6..65c99d0 100644 --- a/gnu/lib/libgcc/Makefile +++ b/gnu/lib/libgcc/Makefile @@ -6,6 +6,12 @@ LIB= gcc SHLIB_NAME= libgcc_s.so.1 SHLIBDIR?= /lib +# +# libgcc is linked in last and thus cannot depend on ssp symbols coming +# from earlier libraries. Disable stack protection for this library. +# +WITHOUT_SSP= yes + .include <bsd.own.mk> .include "${.CURDIR}/../../usr.bin/cc/Makefile.tgt" @@ -18,7 +24,7 @@ CFLAGS+= -DIN_GCC -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED \ -I${.CURDIR}/../../usr.bin/cc/cc_tools LDFLAGS+= -nodefaultlibs -LDADD+= -lc +LDADD+= -lc -lssp_nonshared OBJS= # added to below in various ways depending on TARGET_ARCH diff --git a/gnu/lib/libssp/libssp_nonshared/Makefile b/gnu/lib/libssp/libssp_nonshared/Makefile index 1dcd54f..9454495 100644 --- a/gnu/lib/libssp/libssp_nonshared/Makefile +++ b/gnu/lib/libssp/libssp_nonshared/Makefile @@ -13,6 +13,6 @@ SRCS= ssp-local.c CFLAGS+= -DHAVE_CONFIG_H CFLAGS+= -I${.CURDIR}/.. -I${GCCLIB}/libssp -I${GCCLIB}/include -CFLAGS+= -fPIC -DPIC +CFLAGS+= -fPIC -DPIC -fvisibility=hidden .include <bsd.lib.mk> |