Avoid adding -d to kernel module link command lines for lld >= 14
Since 0b3178a45c
we have added '-d' to the link command line for
kernel modules, so if any unexpected common symbols turn up (even though
we use -fno-common in CFLAGS), storage will be allocated in in the
module itself.
However, with lld this option did not have any effect since ~2017, and
as of lld 14 it warns: "-d, -dc, -dp, and --[no-]define-common will be
removed. See https://github.com/llvm/llvm-project/issues/53660"
Add a linker type and version check, to avoid adding the option for lld
14 and later.
Reported by: bz
MFC after: 2 weeks
This commit is contained in:
parent
373511338d
commit
0817c8dc2a
@ -145,7 +145,11 @@ CFLAGS.gcc+= --param large-function-growth=1000
|
||||
# share/mk/src.sys.mk, but the following is important for out-of-tree modules
|
||||
# (e.g. ports).
|
||||
CFLAGS+= -fno-common
|
||||
LDFLAGS+= -d -warn-common
|
||||
.if ${LINKER_TYPE} != "lld" || ${LINKER_VERSION} < 140000
|
||||
# lld >= 14 warns that -d is deprecated, and will be removed.
|
||||
LDFLAGS+= -d
|
||||
.endif
|
||||
LDFLAGS+= -warn-common
|
||||
|
||||
.if defined(LINKER_FEATURES) && ${LINKER_FEATURES:Mbuild-id}
|
||||
LDFLAGS+= --build-id=sha1
|
||||
@ -247,7 +251,7 @@ ${KMOD}.kld: ${OBJS} ${BLOB_OBJS}
|
||||
.else
|
||||
${FULLPROG}: ${OBJS} ${BLOB_OBJS}
|
||||
.endif
|
||||
${LD} -m ${LD_EMULATION} ${_LDFLAGS} ${LDSCRIPT_FLAGS} -r -d \
|
||||
${LD} -m ${LD_EMULATION} ${_LDFLAGS} ${LDSCRIPT_FLAGS} -r \
|
||||
-o ${.TARGET} ${OBJS} ${BLOB_OBJS}
|
||||
.if ${MK_CTF} != "no"
|
||||
${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS} ${BLOB_OBJS}
|
||||
|
Loading…
Reference in New Issue
Block a user