Add support for linker-type-specific flags

r332090 added a LINKER_TYPE test to add the --no-rosegment flag when
linking the i386 loader components with lld.  Instead, introduce a
general mechanism for setting LDFLAGS for a specific linker type,
and use it for --no-rosegment.

Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D14998
This commit is contained in:
emaste 2018-04-19 20:58:09 +00:00
parent bd489e7960
commit 27d93b37d3
2 changed files with 3 additions and 5 deletions

View File

@ -226,6 +226,8 @@ ACFLAGS+= ${ACFLAGS.${.IMPSRC:T}}
CFLAGS+= ${CFLAGS.${.IMPSRC:T}}
CXXFLAGS+= ${CXXFLAGS.${.IMPSRC:T}}
LDFLAGS+= ${LDFLAGS.${LINKER_TYPE}}
.if defined(SRCTOP)
# Prevent rebuilding during install to support read-only objdirs.
.if ${.TARGETS:M*install*} == ${.TARGETS} && empty(.MAKE.MODE:Mmeta)

View File

@ -2,13 +2,9 @@
#
# $FreeBSD$
.sinclude <bsd.linker.mk>
LOADER_ADDRESS?=0x200000
LDFLAGS+= -nostdlib
.if defined(LINKER_TYPE) && ${LINKER_TYPE} == "lld"
LDFLAGS+= -Wl,--no-rosegment
.endif
LDFLAGS.lld+= -Wl,--no-rosegment
# BTX components
BTXDIR= ${BOOTOBJ}/i386/btx