Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Jan 2012 10:02:45 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r229380 - in stable/9: secure/lib/libcrypto share/mk
Message-ID:  <201201031002.q03A2jFq016204@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Tue Jan  3 10:02:44 2012
New Revision: 229380
URL: http://svn.freebsd.org/changeset/base/229380

Log:
  MFC r228307:
  Force linker error when created shared library contains a relocation
  against text. Provide the override switch to turn off the strict
  behaviour. Apparently, openssl libcrypto needs it due to assembler
  code not being PIC.

Modified:
  stable/9/secure/lib/libcrypto/Makefile
  stable/9/share/mk/bsd.lib.mk
Directory Properties:
  stable/9/secure/lib/libcrypto/   (props changed)
  stable/9/share/mk/   (props changed)

Modified: stable/9/secure/lib/libcrypto/Makefile
==============================================================================
--- stable/9/secure/lib/libcrypto/Makefile	Tue Jan  3 10:01:12 2012	(r229379)
+++ stable/9/secure/lib/libcrypto/Makefile	Tue Jan  3 10:02:44 2012	(r229380)
@@ -7,6 +7,7 @@ SUBDIR=		engines
 
 LIB=		crypto
 SHLIB_MAJOR=	6
+ALLOW_SHARED_TEXTREL=
 
 NO_LINT=
 

Modified: stable/9/share/mk/bsd.lib.mk
==============================================================================
--- stable/9/share/mk/bsd.lib.mk	Tue Jan  3 10:01:12 2012	(r229379)
+++ stable/9/share/mk/bsd.lib.mk	Tue Jan  3 10:02:44 2012	(r229380)
@@ -183,6 +183,11 @@ SOBJS+=		${OBJS:.o=.So}
 .if defined(SHLIB_NAME)
 _LIBS+=		${SHLIB_NAME}
 
+SOLINKOPTS=	-shared -Wl,-x
+.if !defined(ALLOW_SHARED_TEXTREL)
+SOLINKOPTS+=	-Wl,--fatal-warnings -Wl,--warn-shared-textrel
+.endif
+
 .if target(beforelinking)
 ${SHLIB_NAME}: ${SOBJS} beforelinking
 .else
@@ -194,11 +199,11 @@ ${SHLIB_NAME}: ${SOBJS}
 	@ln -fs ${.TARGET} ${SHLIB_LINK}
 .endif
 .if !defined(NM)
-	@${CC} ${LDFLAGS} ${SSP_CFLAGS} -shared -Wl,-x \
+	@${CC} ${LDFLAGS} ${SSP_CFLAGS} ${SOLINKOPTS} \
 	    -o ${.TARGET} -Wl,-soname,${SONAME} \
 	    `lorder ${SOBJS} | tsort -q` ${LDADD}
 .else
-	@${CC} ${LDFLAGS} ${SSP_CFLAGS} -shared -Wl,-x \
+	@${CC} ${LDFLAGS} ${SSP_CFLAGS} ${SOLINKOPTS} \
 	    -o ${.TARGET} -Wl,-soname,${SONAME} \
 	    `NM='${NM}' lorder ${SOBJS} | tsort -q` ${LDADD}
 .endif



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201031002.q03A2jFq016204>