lld 12 assertion failed on 14/aarch64

From: Ronald Klop <ronald-lists_at_klop.ws>
Date: Fri, 06 Aug 2021 20:45:46 UTC
Hi,

My port databases/mongodb50 (and mongodb44) gets an assertion on 14-current using the base clang12.

See: http://www.ipv6proxy.net/go.php?u=http%3A%2F%2Fampere2.nyi.freebsd.org%2Fdata%2Fmain-arm64-default%2Fp55c8c5ac7db5_saaccfdde3d%2Flogs%2Ferrors%2Fmongodb50-5.0.1.log&b=0&f=norefer

The error is:
Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file /usr/local/poudriere/jails/main-arm64/usr/src/contrib/llvm-project/llvm/include/llvm/Support/Casting.h, line 269.
PLEASE submit a bug report to https://bugs.freebsd.org/submit/ and include the crash backtrace.

Any thoughts on how to fix this?

It does not happen on my RPI4 + poudriere at home although I have LTO disabled because of memory constraints.

Regards,
Ronald.