Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 May 2020 11:14:29 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r360656 - stable/11/sys/conf
Message-ID:  <202005051114.045BETMD015882@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Tue May  5 11:14:28 2020
New Revision: 360656
URL: https://svnweb.freebsd.org/changeset/base/360656

Log:
  MFC r316513 (by jhb):
  
  Sync SYSTEM_LD in Makefile.arm with kern.pre.mk.
  
  - Add --no-warn-mismatch.
  - Use same whitespace to make future updates simpler.
  
  Reviewed by:	imp (part of a larger change)
  Sponsored by:	DARPA / AFRL
  Differential Revision:	https://reviews.freebsd.org/D10085
  
  MFC r316514 (by jhb):
  
  Always pass the linker emulation via -m when linking modules and kernels.
  
  Previously the linker emulation was only passed when building binary
  objects for firmware modules.  This change always passes the desired
  output format for kernel modules and kernels rather than requiring the
  toolchain's default output format to match the desired output format.
  This in turn permits use of external toolchains whose default output
  format does not match the desired output format.
  
  Reviewed by:	imp, emaste
  Sponsored by:	DARPA / AFRL
  Differential Revision:	https://reviews.freebsd.org/D10085
  
  MFC r320179 (by emaste):
  
  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
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D11250

Modified:
  stable/11/sys/conf/Makefile.arm
  stable/11/sys/conf/kern.mk
  stable/11/sys/conf/kern.pre.mk
  stable/11/sys/conf/kmod.mk
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/conf/Makefile.arm
==============================================================================
--- stable/11/sys/conf/Makefile.arm	Tue May  5 10:01:10 2020	(r360655)
+++ stable/11/sys/conf/Makefile.arm	Tue May  5 11:14:28 2020	(r360656)
@@ -61,9 +61,10 @@ KERNVIRTADDR= 0xc0000000
 # hack because genassym.c includes sys/bus.h which includes these.
 genassym.o: bus_if.h device_if.h
 
-SYSTEM_LD_ = ${LD} -Bdynamic -T ldscript.$M.noheader ${_LDFLAGS} \
-	  -warn-common -export-dynamic -dynamic-linker /red/herring -o \
-	   ${FULLKERNEL}.noheader -X ${SYSTEM_OBJS} vers.o
+SYSTEM_LD_ = ${LD} -m ${LD_EMULATION} -Bdynamic -T ldscript.$M.noheader \
+	${_LDFLAGS} --no-warn-mismatch --warn-common --export-dynamic \
+	--dynamic-linker /red/herring \
+	-o ${FULLKERNEL}.noheader -X ${SYSTEM_OBJS} vers.o
 SYSTEM_LD_TAIL +=;sed s/" + SIZEOF_HEADERS"// ldscript.$M\
 		>ldscript.$M.noheader; \
 		${SYSTEM_LD_}; \

Modified: stable/11/sys/conf/kern.mk
==============================================================================
--- stable/11/sys/conf/kern.mk	Tue May  5 10:01:10 2020	(r360655)
+++ stable/11/sys/conf/kern.mk	Tue May  5 11:14:28 2020	(r360656)
@@ -256,8 +256,7 @@ CFLAGS+=        -std=iso9899:1999
 CFLAGS+=        -std=${CSTD}
 .endif # CSTD
 
-# Set target-specific linker emulation name. Used by ld -b binary to convert
-# binary files into ELF objects.
+# Set target-specific linker emulation name.
 LD_EMULATION_aarch64=aarch64elf
 LD_EMULATION_amd64=elf_x86_64_fbsd
 LD_EMULATION_arm=armelf_fbsd

Modified: stable/11/sys/conf/kern.pre.mk
==============================================================================
--- stable/11/sys/conf/kern.pre.mk	Tue May  5 10:01:10 2020	(r360655)
+++ stable/11/sys/conf/kern.pre.mk	Tue May  5 11:14:28 2020	(r360656)
@@ -206,8 +206,9 @@ MD_ROOT_SIZE_CONFIGURED!=	grep MD_ROOT_SIZE opt_md.h |
 SYSTEM_OBJS+= embedfs_${MFS_IMAGE:T:R}.o
 .endif
 .endif
-SYSTEM_LD= @${LD} -Bdynamic -T ${LDSCRIPT} ${_LDFLAGS} --no-warn-mismatch \
-	--warn-common --export-dynamic --dynamic-linker /red/herring \
+SYSTEM_LD= @${LD} -m ${LD_EMULATION} -Bdynamic -T ${LDSCRIPT} ${_LDFLAGS} \
+	--no-warn-mismatch --warn-common --export-dynamic \
+	--dynamic-linker /red/herring \
 	-o ${.TARGET} -X ${SYSTEM_OBJS} vers.o
 SYSTEM_LD_TAIL= @${OBJCOPY} --strip-symbol gcc2_compiled. ${.TARGET} ; \
 	${SIZE} ${.TARGET} ; chmod 755 ${.TARGET}

Modified: stable/11/sys/conf/kmod.mk
==============================================================================
--- stable/11/sys/conf/kmod.mk	Tue May  5 10:01:10 2020	(r360655)
+++ stable/11/sys/conf/kmod.mk	Tue May  5 11:14:28 2020	(r360656)
@@ -228,7 +228,8 @@ ${PROG}.debug: ${FULLPROG}
 
 .if ${__KLD_SHARED} == yes
 ${FULLPROG}: ${KMOD}.kld
-	${LD} -Bshareable ${_LDFLAGS} -o ${.TARGET} ${KMOD}.kld
+	${LD} -m ${LD_EMULATION} -Bshareable -znotext ${_LDFLAGS} \
+	    -o ${.TARGET} ${KMOD}.kld
 .if !defined(DEBUG_FLAGS)
 	${OBJCOPY} --strip-debug ${.TARGET}
 .endif
@@ -244,7 +245,7 @@ ${KMOD}.kld: ${OBJS}
 .else
 ${FULLPROG}: ${OBJS}
 .endif
-	${LD} ${_LDFLAGS} -r -d -o ${.TARGET} ${OBJS}
+	${LD} -m ${LD_EMULATION} ${_LDFLAGS} -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?202005051114.045BETMD015882>