svn commit: r333470 - in head: share/mk sys/conf

Ed Maste emaste at FreeBSD.org
Thu May 10 20:10:04 UTC 2018


Author: emaste
Date: Thu May 10 20:10:02 2018
New Revision: 333470
URL: https://svnweb.freebsd.org/changeset/base/333470

Log:
  Error out on attempt to link amd64 kernel with old binutils linker
  
  As of r333461 we require ifunc support to link a working amd64 kernel.
  The default in-tree bootstrap linker is lld and it has the required
  support, as does any modern out-of-tree binutils linker.  The in-tree
  GNU ld is from binutils 2.17.50 and it does not have ifunc support,
  so produce an error rather than a broken kernel.
  
  Reviewed by:	kib
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D15378

Modified:
  head/share/mk/bsd.linker.mk
  head/sys/conf/kern.pre.mk

Modified: head/share/mk/bsd.linker.mk
==============================================================================
--- head/share/mk/bsd.linker.mk	Thu May 10 19:13:00 2018	(r333469)
+++ head/share/mk/bsd.linker.mk	Thu May 10 20:10:02 2018	(r333470)
@@ -71,6 +71,7 @@ ${X_}LINKER_VERSION!=	echo "${_v:M[1-9].[0-9]*}" | \
 ${X_}LINKER_FEATURES=
 .if ${${X_}LINKER_TYPE} != "bfd" || ${${X_}LINKER_VERSION} > 21750
 ${X_}LINKER_FEATURES+=	build-id
+${X_}LINKER_FEATURES+=	ifunc
 .endif
 .if ${${X_}LINKER_TYPE} != "lld" || ${${X_}LINKER_VERSION} >= 50000
 ${X_}LINKER_FEATURES+=	filter

Modified: head/sys/conf/kern.pre.mk
==============================================================================
--- head/sys/conf/kern.pre.mk	Thu May 10 19:13:00 2018	(r333469)
+++ head/sys/conf/kern.pre.mk	Thu May 10 20:10:02 2018	(r333470)
@@ -121,6 +121,9 @@ LDFLAGS+=	-Wl,--build-id=sha1
 .endif
 
 .if ${MACHINE_CPUARCH} == "amd64"
+.if defined(LINKER_FEATURES) && ${LINKER_FEATURES:Mifunc} == ""
+.error amd64 kernel requires linker ifunc support
+.endif
 LDFLAGS+=	-Wl,-z max-page-size=2097152 -Wl,-z common-page-size=4096
 .endif
 


More information about the svn-src-head mailing list