Illegal instruction (core dumped) on RISC-V

Bug #1994071 reported by Denis Ovsienko
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
llvm-defaults (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

$ clang --version
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: clang --version
1. Compilation construction
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
/lib/riscv64-linux-gnu/libLLVM-14.so.1(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamEi+0x38)[0x3f8bbaf6ee]
Illegal instruction (core dumped)

ii clang-14 1:14.0.0-1ubuntu1 riscv64 C, C++ and Objective-C compiler
ii libllvm14:riscv64 1:14.0.0-1ubuntu1 riscv64 Modular compiler and toolchain technologies, runtime library

$ uname -a
Linux linux-riscv64 5.17.0-1007-allwinner #7-Ubuntu SMP Fri Oct 14 15:43:39 UTC 2022 riscv64 riscv64 riscv64 GNU/Linux

Steps to reproduce:
1. Install Ubuntu 22.04.1 RISC-V from https://cdimage.ubuntu.com/releases/22.04.1/release/ubuntu-22.04.1-preinstalled-server-riscv64+nezha.img.xz on a Nezha D1 board (1GB RAM).
2. Install all updates.
3. apt-get install clang
4. Run clang.

Let me know in case you need additional diagnostics. SSH access can be provided on request to project developers.

tags: added: foundation-todo
Revision history for this message
Alexandre Ghiti (alexghiti) wrote :

Thanks for all the steps, the issue is easily reproducible.

The illegal instruction trap is caused by a 'fence.tso' instruction that the C906 core in the D1 SoC fails to decode: it is known issue and fixed in opensbi 1.1 by emulating a fence instead.

I filled an SRU here https://bugs.launchpad.net/ubuntu/+source/llvm-defaults/+bug/1995080 and I'm testing the fix in my ppa:alexghiti/riscv.

Thanks again for the report,

Alex

tags: added: foundations-todo
removed: foundation-todo
Revision history for this message
Denis Ovsienko (dovsienko) wrote :

For what it's worth, the current version does not immediately fail after start:

$ uname -r
5.17.0-1010-allwinner

$ clang --version
Ubuntu clang version 14.0.0-1ubuntu1
Target: riscv64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

ii clang 1:14.0-55~exp2 riscv64
ii nezha-boot0 20220228+g0ad88bf-0ubuntu2~22.04.1

If this problem is considered fixed, I can add Clang into the same workload that GCC does on this board and stress-test Clang more.

Revision history for this message
Heinrich Schuchardt (xypron) wrote :

OpenSBI 1.1 is in Jammy since 2022-11-29. U-Boot for Jammy has been updated in 2022-12-06 using that OpenSBI. So the issue can be considered fixed since then.

Changed in llvm-defaults (Ubuntu):
status: New → Fix Released
Revision history for this message
Denis Ovsienko (dovsienko) wrote :

Thank you for confirming, I confirm in my test Clang can compile the full project again, so this bug looks resolved.

Benjamin Drung (bdrung)
tags: removed: foundations-todo
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.