maintainer-feedback requested: [Bug 268328] www/firefox fails to build with LTO enabled

From: <>
Date: Mon, 12 Dec 2022 11:26:47 UTC
Bugzilla Automation <> has asked freebsd-gecko (Nobody)
<> for maintainer-feedback:
Bug 268328: www/firefox fails to build with LTO enabled

--- Description ---
On FreeBSD/amd64 13.1-RELEASE-p5, when I built www/firefox with LTO option
enabled (because I built it for updating before ports tree
fc0a979a30ea24c8d28d8a3893bb5ac0549e56cb , which was enabled by default), it
failed with:

/usr/local/bin/clang13 -Qunused-arguments -std=gnu99 -U_FORTIFY_SOURCE
-D_FORTIFY_SOURCE=2 -fstack-protector-strong -fstack-clash-protection
-DLIBICONV_PLUG -isystem /usr/local/include -O2 -pipe -O3 -DLIBICONV_PLUG
-fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -fPIC
-ffunction-sections -fdata-sections -fno-math-errno -pipe -O2 -O3
-fomit-frame-pointer -funwind-tables  -shared -Wl,-z,defs
-Wl,--warn-unresolved-symbols -Wl,--gc-sections -Wl,-h, -o stub.o  -flto=thin -Wl,-plugin-opt=-import-instr-limit=10
-Wl,-plugin-opt=-import-hot-multiplier=30 -pthread -Wl,--as-needed
-fstack-protector-strong -Wl,-z,noexecstack -Wl,-z,text -Wl,-z,relro
-Wl,-z,nocopyreloc -Wl,-Bsymbolic-functions -Wl,--build-id=sha1
-fstack-protector-strong -fstack-clash-protection
 -Wl,--version-script,  -L/usr/local/lib
ld: error:
Unknown attribute kind (82) (Producer: 'LLVM15.0.0-rust-1.65.0-stable' Reader:
'LLVM 13.0.1')
clang-13: error: linker command failed with exit code 1 (use -v to see

It seems it was caused by llvm version missmatch between objects produced by
Rust and clang13. 

And why clang13 is used is the description below in Mk/

#    if !defined(DEFAULT_VERSIONS) || ! ${DEFAULT_VERSIONS:Mllvm*} ||
LLVM_DEFAULT=	13 # chase bundled LLVM in lang/rust for LTO
LLVM_VERSION=	13.0.1 # keep in sync with
#    endif

actually after I run 'make config' to unset LTO option, the port was built