HomeFreeBSD

Avoid adding -d to kernel module link command lines for lld >= 14

Description

Avoid adding -d to kernel module link command lines for lld >= 14

Since 0b3178a45cd0 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

(cherry picked from commit 0817c8dc2a48efedac38d1b9b5c4747a15dbe840)

Details

Provenance
dimAuthored on May 14 2022, 8:07 PM
Parents
rG84f5770003c4: ASAN: reduce verbosity
Branches
Unknown
Tags
Unknown