Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Oct 2019 20:15:04 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r354096 - head/sys/conf
Message-ID:  <201910252015.x9PKF4Tu098215@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201910252015.x9PKF4Tu098215>