Author: markj
Date: Fri Oct 25 20:15:04 2019
New Revision: 354096
URL: https://svnweb.freebsd.org/changeset/base/354096

Log:
  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

Modified:
  head/sys/conf/kmod.mk

Modified: head/sys/conf/kmod.mk
==============================================================================
--- head/sys/conf/kmod.mk       Fri Oct 25 20:09:42 2019        (r354095)
+++ head/sys/conf/kmod.mk       Fri Oct 25 20:15:04 2019        (r354096)
@@ -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
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to