[Bug 258358] Risc-V clang-tblgen: Exec format error

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

            Bug ID: 258358
           Summary: Risc-V clang-tblgen: Exec format error
           Product: Base System
           Version: CURRENT
          Hardware: riscv
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: riscv
          Assignee: riscv@FreeBSD.org
          Reporter: maciphone2@googlemail.com

--environment:--
root@rv64:/usr/src # uname -paKU
FreeBSD rv64 14.0-CURRENT FreeBSD 14.0-CURRENT #3 main-n249176-936f4a42fa2a:
Mon Sep  6 23:02:54 UTC 2021    
root@rv64:/usr/obj/usr/src/riscv.riscv64/sys/GENERIC-NODEBUG  riscv riscv64
1400032 1400032
-
root@rv64:/usr/src # sysctl hw
hw.machine: riscv
hw.ncpu: 4
hw.byteorder: 1234
hw.physmem: 8578408448
-
root@rv64:/usr/src # git show HEAD
commit 85bea309f935111cb362035795a59c263536b065 (HEAD -> main, origin/main,
origin/HEAD)
...
Date:   Tue Sep 7 17:28:50 2021 +0100
-
crossBuilt from aarch64->Risc-V into NFS-directory, PXE-boot 
(make buildkernel/installkernel directly on hardware successful)

-- error:---
root@rv64:/usr/src # make -j4 buildworld
...
..
===> usr.sbin/autofs (includes)
--- includes_subdir_lib ---
--- arm_bf16.h ---
clang-tblgen -gen-arm-bf16  -I
/usr/src/contrib/llvm-project/clang/include/clang/Basic -d arm_bf16.h.d  -o
arm_bf16.h /usr/src/contrib/llvm-project/clang/include/clang/Basic/arm_bf16.td
ELF binary type "0" not known.
sh: clang-tblgen: Exec format error
*** [arm_bf16.h] Error code 126

make[5]: stopped in /usr/src/lib/clang/headers
      158.16 real       237.44 user        63.86 sys

make[1]: stopped in /usr/src

.....

-- somewhat raw but effective workaround : ---

<<<<
root@rv64:/usr/src # clang-tblgen --version
LLVM (http://llvm.org/):
  LLVM version 12.0.1
  Optimized build with assertions.
  Default target: riscv64-unknown-freebsd14.0
  Host CPU: (unknown)

root@rv64:/usr/src # brandelf -v
/usr/obj/usr/src/riscv.riscv64/tmp/obj-tools/usr.bin/clang/clang-tblgen/clang-tblgen
File
'/usr/obj/usr/src/riscv.riscv64/tmp/obj-tools/usr.bin/clang/clang-tblgen/clang-tblgen'
is of brand 'SVR4' (0). 
>>>>>

root@rv64:/usr/src # cp /usr/bin/clang-tblgen
/usr/obj/usr/src/riscv.riscv64/tmp/obj-tools/usr.bin/clang/clang-tblgen/clang-tblgen
  :-)

-
root@rv64:/usr/src # make -j4 buildworld NO_CLEAN=yes ....
continue...
---

this bug happens only when building directly on the hardware, not when cross
compiling.

-- 
You are receiving this mail because:
You are the assignee for the bug.