Code:
toolkit/library/build/libxul.so
rm -f ../../../dist/bin/libxul.so
/usr/local/bin/clang++19 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fstack-clash-protection -fstrict-flex-arrays=1 -DLIBICONV_PLUG -isystem /usr/local/include -fno-rtti -pthread -fno-sized-deallocation -fno-aligned-new -ffunction-sections -fdata-sections -fno-math-errno -fno-exceptions -fPIC -O2 -pipe -O3 -DLIBICONV_PLUG -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -DLIBICONV_PLUG -isystem /usr/local/include -O2 -O3 -fomit-frame-pointer -funwind-tables -shared -Wl,-z,defs -Wl,--warn-unresolved-symbols -Wl,--gc-sections -Wl,-h,libxul.so -o ../../../dist/bin/libxul.so -Wl,@/usr/ports/www/firefox/work/.build/toolkit/library/build/libxul_so.list -flto=thin -Wl,-plugin-opt=-import-instr-limit=10 -Wl,-plugin-opt=-import-hot-multiplier=30 -Wl,--as-needed -Wl,--undefined-version -fstack-protector-strong -Wl,--icf=safe -Wl,--build-id=sha1 -Wl,-z,noexecstack -Wl,-z,text -Wl,-z,relro -Wl,-z,now -Wl,-z,nocopyreloc -fuse-ld=lld -fstack-protector-strong -fstack-clash-protection -Wl,-rpath-link,/usr/ports/www/firefox/work/.build/dist/bin -O2 -O3 ../../../js/src/build/libjs_static.a ../../../build/pure_virtual/libpure_virtual.a ../../../x86_64-unknown-freebsd/release/libgkrust.a ../../../dist/bin/libgkcodecs.so ../../../dist/bin/liblgpllibs.so ../../../dist/bin/libmozsqlite3.so ../../../dist/bin/libmozgtk.so -Wl,--version-script,libxul.so.symbols -L/usr/local/lib -licui18n -licuuc -ldl -lX11 -lXcomposite -lXdamage -lXext -lXfixes -lXrandr -lXrender -lpthread -lffi -lplds4 -lplc4 -lnspr4 -pthread -lz -lm -lnss3 -lsmime3 -lssl3 -lnssutil3 -lfreetype -lfontconfig -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lintl -lutil -ljpeg -lpng16 -lwebpdemux -lwebp -lgraphite2 -levent -lvpx -lpixman-1 -lxcb-shm -lX11-xcb -lXcursor -lXi -lxcb
ld.lld: error: Invalid summary version 12. Version should be in the range [1-10].
ld.lld: error: Invalid summary version 12. Version should be in the range [1-10].
ld.lld: error: Invalid summary version 12. Version should be in the range [1-10].
ld.lld: error: Invalid summary version 12. Version should be in the range [1-10].
ld.lld: error: Invalid summary version 12. Version should be in the range [1-10].
ld.lld: error: Invalid summary version 12. Version should be in the range [1-10].
ld.lld: error: Invalid summary version 12. Version should be in the range [1-10].
ld.lld: error: Invalid summary version 12. Version should be in the range [1-10].
ld.lld: error: Invalid summary version 12. Version should be in the range [1-10].
ld.lld: error: Invalid summary version 12. Version should be in the range [1-10].
ld.lld: error: Invalid summary version 12. Version should be in the range [1-10].
ld.lld: error: Invalid summary version 12. Version should be in the range [1-10].
ld.lld: error: Invalid summary version 12. Version should be in the range [1-10].
ld.lld: error: Invalid summary version 12. Version should be in the range [1-10].
ld.lld: error: Invalid summary version 12. Version should be in the range [1-10].
ld.lld: error: Invalid summary version 12. Version should be in the range [1-10].
ld.lld: error: Invalid summary version 12. Version should be in the range [1-10].
ld.lld: error: Invalid summary version 12. Version should be in the range [1-10].
ld.lld: error: Invalid summary version 12. Version should be in the range [1-10].
ld.lld: error: Invalid summary version 12. Version should be in the range [1-10].
ld.lld: error: too many errors emitted, stopping now (use --error-limit=0 to see all errors)
When trying to build Firefox from ports, I get the above error from the linker multiple times and it predictably fails.
Prof Googly suggests the problem is caused by the LLVM version used to build clang and rust not matching. Alas, after rebuilding not only clang and rust but all of the Firefox dependancies, the problem remained.
The solution: disable the Firefox link time optimisation option. See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=279140#c7