diff options
author | kib <kib@FreeBSD.org> | 2011-12-06 11:28:17 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2011-12-06 11:28:17 +0000 |
commit | a56c72dcf2baa76870e19aeed748720318e27afc (patch) | |
tree | 5166dcaeaf451638068ea850d6b60aab4d8e55c7 /share | |
parent | 12e8232d4db8b80e5a4da1575bcfad518f1f867b (diff) | |
download | FreeBSD-src-a56c72dcf2baa76870e19aeed748720318e27afc.zip FreeBSD-src-a56c72dcf2baa76870e19aeed748720318e27afc.tar.gz |
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.
Discussed with: bf
MFC after: 2 weeks
Diffstat (limited to 'share')
-rw-r--r-- | share/mk/bsd.lib.mk | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index 1e43921..a4abe2f 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -167,6 +167,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 @@ -178,11 +183,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 |