lang/gcc on riscv64 has a wart, it creates such relocs which upset ld.lld.
The workaround I have used in lang/gcc since Sep 2022 doesn't work any
more, so ask ld.lld to be more lenient. This will let the fortran ports
and friends build on riscv64. clang has fixed since some time already,
but our lang/gcc port will likely keep that wart for some time.
Upstream report: https://reviews.llvm.org/D83244
Input and ok kettenis@
if (sym.discardedSecIdx != 0 && (sec.name == ".got2" || sec.name == ".toc"))
return false;
+#ifdef __OpenBSD__
+ // GCC (at least 8 and 11) can produce a ".gcc_except_table" with relocations
+ // to discarded sections on riscv64
+ if (sym.discardedSecIdx != 0 && sec.name == ".gcc_except_table")
+ return false;
+#endif
+
bool isWarning =
(config->unresolvedSymbols == UnresolvedPolicy::Warn && canBeExternal) ||
config->noinhibitExec;