summaryrefslogtreecommitdiffstats
path: root/gnu/lib
diff options
context:
space:
mode:
authorkan <kan@FreeBSD.org>2009-07-14 21:19:13 +0000
committerkan <kan@FreeBSD.org>2009-07-14 21:19:13 +0000
commitef443476d9706035ac219f0280ef0b817dda7a6d (patch)
tree50c2540e7067c9b377ade1910cd0348aeab454e7 /gnu/lib
parentd81f73fcb520cff58dcafda0e644b91837b26a40 (diff)
downloadFreeBSD-src-ef443476d9706035ac219f0280ef0b817dda7a6d.zip
FreeBSD-src-ef443476d9706035ac219f0280ef0b817dda7a6d.tar.gz
Second attempt at eliminating .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 every time given shared library is being relocated and making affected text pages non-shareable. Reviewed by: kib Approved by: re (kib)
Diffstat (limited to 'gnu/lib')
-rw-r--r--gnu/lib/libgcc/Makefile6
-rw-r--r--gnu/lib/libssp/libssp_nonshared/Makefile2
2 files changed, 7 insertions, 1 deletions
diff --git a/gnu/lib/libgcc/Makefile b/gnu/lib/libgcc/Makefile
index 49b96e6..399aff8 100644
--- a/gnu/lib/libgcc/Makefile
+++ b/gnu/lib/libgcc/Makefile
@@ -7,6 +7,12 @@ SHLIB_NAME= libgcc_s.so.1
SHLIBDIR?= /lib
.include <bsd.own.mk>
+#
+# libgcc is linked in last and thus cannot depend on ssp symbols coming
+# from earlier libraries. Disable stack protection for this library.
+#
+MK_SSP= no
+
.include "${.CURDIR}/../../usr.bin/cc/Makefile.tgt"
.PATH: ${GCCDIR}/config/${GCC_CPU} ${GCCDIR}/config ${GCCDIR}
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>
OpenPOWER on IntegriCloud