[Bug 258358] Fails to build on riscv: arm_bf16.h: sh: clang-tblgen: Exec format error

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 08 Sep 2021 09:29:25 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=258358

--- Comment #4 from Jessica Clarke <jrtc27@freebsd.org> ---
This is a known issue. We build the bootstrap tool as a static binary and with
--gc-sections. The latter is key, as ELF notes are not considered as GC roots
when COMDAT, as was made the case last year for the ABI note. Because RISC-V
isn’t using EI_OSABI on FreeBSD there’s then no branding in the binary for the
kernel to recognise (you need at least one of that, the dynamic linker path or
the ELF note). The fix for this is to stop making the note COMDAT and put it
only in crti.

There is a workaround. Find the -Wl,--gc-sections (IIRC it’s in
usr.bin/clang/llvm.build.mk) and add ,-melf64lriscv_fbsd to the end of it.

-- 
You are receiving this mail because:
You are on the CC list for the bug.