Interesting, with an 'int main(void) { }' program I can compile that from the command line, using the '-march' which the 'cmake' seems to be using -That produces an 'xyzzy.s' as expected. That contains what looks to be RISC-V assembler and includes -So the compiler seems to be working, just not the assembler as also observed by building without the '-S' option -So seems to be down down to a missing or incorrectly configured assembler.
It looks like it's there so no idea why it's not working, isn't compiled for the architecture specified -Assembling the previous 'xyzzy.s' works just fine, produces the anticipated 'a.out' -Compiling with the '-march' and '-mabi' the 'cmake' seems to be applying also works - So why doesn't it work with 'cmake' ?
But, more so - Why does it work when done as a two-step process, but not with the single 'gcc' invocation ?
Solve that and I expect it will also fix 'cmake' builds.
Aha! It seems to be building with the 'gcc' at the location the './configure -prefix' put it -So presumably it's not possible to simply copy stuff from where it is to where I want it to be and have it work.
Looks like I need to add where it is to my 'path' or rebuild with an appropriate './configure -prefix'.
Code:
/usr/bin/riscv32-unknown-elf-gcc -march=rv32imac_zicsr_zifencei_zba_zbb_zbs_zbkb -mabi=ilp32 -S xyzzy.c
Code:
.attribute arch, "rv32i2p1_m2p0_a2p1_c2p0_zicsr2p0_zifencei2p0_zba1p0_zbb1p0_zbkb1p0_zbs1p0"
Code:
pi@Pi4B:~/apps/riscv $ /usr/bin/riscv32-unknown-elf-gcc -march=rv32imac_zicsr_zifencei_zba_zbb_zbs_zbkb -mabi=ilp32 xyzzy.cAssembler messages:Error: unknown architecture `rv32imac_zicsr_zifencei_zba_zbb_zbs_zbkb'Error: unrecognized option -march=rv32imac_zicsr_zifencei_zba_zbb_zbs_zbkb
It looks like it's there so no idea why it's not working, isn't compiled for the architecture specified -
Code:
pi@Pi4B:~/apps/riscv $ /usr/bin/riscv32-unknown-elf-as --versionGNU assembler (GNU Binutils) 2.43Copyright (C) 2024 Free Software Foundation, Inc.This program is free software; you may redistribute it under the terms ofthe GNU General Public License version 3 or later.This program has absolutely no warranty.This assembler was configured for a target of `riscv32-unknown-elf'.
Code:
pi@Pi4B:~/apps/riscv $ /usr/bin/riscv32-unknown-elf-as xyzzy.s
Code:
pi@Pi4B:~/apps/riscv $ file a.outa.out: ELF 32-bit LSB relocatable, UCB RISC-V, RVC, soft-float ABI, version 1 (SYSV), not stripped
Code:
pi@Pi4B:~/apps/riscv $ /usr/bin/riscv32-unknown-elf-as -march=rv32imac_zicsr_zifencei_zba_zbb_zbs_zbkb -mabi=ilp32 xyzzy.s
But, more so - Why does it work when done as a two-step process, but not with the single 'gcc' invocation ?
Solve that and I expect it will also fix 'cmake' builds.
Aha! It seems to be building with the 'gcc' at the location the './configure -prefix' put it -
Code:
pi@Pi4B:~/apps/riscv $ /opt/riscv/gcc14-rp2350-no-zcmp/bin/riscv32-unknown-elf-gcc -arch=rv32imac_zicsr_zifencei_zba_zbb_zbs_zbkb -mabi=ilp32 xyzzy.c
Looks like I need to add where it is to my 'path' or rebuild with an appropriate './configure -prefix'.
Statistics: Posted by hippy — Fri Aug 16, 2024 5:37 pm