aboutsummaryrefslogtreecommitdiff
path: root/sys/conf/kmod.mk
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2019-10-25 20:15:04 +0000
committerMark Johnston <markj@FreeBSD.org>2019-10-25 20:15:04 +0000
commitecae3df1db025f84d0b4c77c00c5c2e66ac70f1e (patch)
treef5974bacb4371b54aa258d6034094db64e9e8888 /sys/conf/kmod.mk
parent5e921ff49ea8bb70506248a4675894729cdad8c2 (diff)
downloadsrc-ecae3df1db025f84d0b4c77c00c5c2e66ac70f1e.tar.gz
src-ecae3df1db025f84d0b4c77c00c5c2e66ac70f1e.zip
Apply kernel module linker scripts to firmware files.
Use a separate make variable to specify the linker script so that it is only applied at link time and not during intermediate generation of .fwo files. This ensures that the .text padding inserted by the amd64 linker script is applied to the stub module load handlers embedded in firmware modules. Reviewed by: kib MFC after: 2 weeks Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D22125
Notes
Notes: svn path=/head/; revision=354096
Diffstat (limited to 'sys/conf/kmod.mk')
-rw-r--r--sys/conf/kmod.mk7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/conf/kmod.mk b/sys/conf/kmod.mk
index 4218d0ed7416..8b7d57207ce0 100644
--- a/sys/conf/kmod.mk
+++ b/sys/conf/kmod.mk
@@ -242,8 +242,8 @@ EXPORT_SYMS?= NO
CLEANFILES+= export_syms
.endif
-.if !defined(FIRMWS) && exists(${SYSDIR}/conf/ldscript.kmod.${MACHINE_ARCH})
-_LDFLAGS+=-T ${SYSDIR}/conf/ldscript.kmod.${MACHINE_ARCH}
+.if exists(${SYSDIR}/conf/ldscript.kmod.${MACHINE_ARCH})
+LDSCRIPT_FLAGS?= -T ${SYSDIR}/conf/ldscript.kmod.${MACHINE_ARCH}
.endif
.if ${__KLD_SHARED} == yes
@@ -251,7 +251,8 @@ ${KMOD}.kld: ${OBJS}
.else
${FULLPROG}: ${OBJS}
.endif
- ${LD} -m ${LD_EMULATION} ${_LDFLAGS} -r -d -o ${.TARGET} ${OBJS}
+ ${LD} -m ${LD_EMULATION} ${_LDFLAGS} ${LDSCRIPT_FLAGS} -r -d \
+ -o ${.TARGET} ${OBJS}
.if ${MK_CTF} != "no"
${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS}
.endif