Bug in gcc and gas
jacob navia
jacob@jacob.remcomp.fr
Fri Aug 25 11:43:30 GMT 2023
Hi
Neither gcc nor gas recognize the Zbb and Zba instructions under linux.
You have to force gcc with:, "march=rv64gc_zbb »
This is an undocumented option.
The processor is an Sifive U74 and in the documentation of that processor those instructions are present.
star64:~/tiny-asm$ uname -a
Linux star64 5.15.115 #1 SMP Sat Jun 10 09:56:27 UTC 2023 riscv64 riscv64 riscv64 GNU/Linux
All versions of gcc up to 13 have this bug.
Maybe the problem is not with gcc but with linux itself:
star64:~/tiny-asm$ cat /proc/cpuinfo
processor : 0
hart : 1
isa : rv64imafdc
mmu : sv39
isa-ext :
uarch : sifive,u74-mc
…
In the « Isa » entry, those extensions are absent.
This is a general problem with riscv. How can a user program know which CPU extensions are installed in the processor?
There is a dedicated register that would be possible to query the register
M-mode instruction set architecture register (misa)
But this is possible only in M mode. Should the libc in riscv develop a special function that returns the value of this register? Would it be possible or that would need a device driver if there isn’t any system call that would do that?
Jacob
More information about the Binutils
mailing list