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
This commit is contained in:
Konstantin Belousov 2011-12-06 11:28:17 +00:00
parent 93c26de0ad
commit bd4632e6ca
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=228307
2 changed files with 8 additions and 2 deletions

View File

@ -7,6 +7,7 @@ SUBDIR= engines
LIB= crypto
SHLIB_MAJOR= 6
ALLOW_SHARED_TEXTREL=
NO_LINT=

View File

@ -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