add -znotext to kernel module link invocation

ARM kernel modules require .text relocations (DT_TEXTREL) in shared
object ouptut, which is not allowed by default by lld.  Add the -znotext
option to enable this.  For simplicity add it unconditionally: it is
already default and thus either redundant (GNU BFD ld and gold from
ports) or ignored as an unknown option (GNU BFD ld 2.17.50 in the base
system).

Reviewed by:	kib
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D11250
This commit is contained in:
Ed Maste 2017-06-21 00:33:16 +00:00
parent eb76cfbcb7
commit 5964294736

View File

@ -210,8 +210,8 @@ ${PROG}.debug: ${FULLPROG}
.if ${__KLD_SHARED} == yes
${FULLPROG}: ${KMOD}.kld
.if ${MACHINE_CPUARCH} != "aarch64"
${LD} -m ${LD_EMULATION} -Bshareable ${_LDFLAGS} -o ${.TARGET} \
${KMOD}.kld
${LD} -m ${LD_EMULATION} -Bshareable -znotext ${_LDFLAGS} \
-o ${.TARGET} ${KMOD}.kld
.else
#XXXKIB Relocatable linking in aarch64 ld from binutils 2.25.1 does
# not work. The linker corrupts the references to the external