Open Alexix24 opened 10 months ago
@llvm/issue-subscribers-backend-risc-v
Author: None (Alexix24)
cc @MaskRay
I think your clang command isn't running the linker. Probably need to run ld separately or remove the -c
?
I think your clang command isn't running the linker. Probably need to run ld separately or remove the
-c
?
Hi,
I removed the -c argument to get the linker running :
clang -v -target riscv32 -march=rv32ia --gcc-toolchain=/usr/local/bin/gcc/7.5.0/ kernel.s -o kernel.bin
I now receive an error at link time:
clang version 17.0.5
Target: riscv32--
Thread model: posix
InstalledDir: /usr/local/bin/llvm/bin
"/usr/local/bin/llvm/bin/clang-17" -cc1as -triple riscv32-- -filetype obj -main-file-name kernelFunction.s -target-cpu generic-rv32 -target-feature +a ......."
/usr/bin/ld: unrecognised emulation mode: elf32lriscv
Supported emulations: elf_x86_64 elf32_x86_64 elf_i386 elf_iamcu i386linux elf_l1om elf_k1om
clang: error: ld command failed with exit code 1 (use -v to see invocation)
Thank you for your help !
I think your clang command isn't running the linker. Probably need to run ld separately or remove the
-c
?Hi, I removed the -c argument to get the linker running :
clang -v -target riscv32 -march=rv32ia --gcc-toolchain=/usr/local/bin/gcc/7.5.0/ kernel.s -o kernel.bin
You are using system linker, not the one for riscv. The path to riscv gnu toolchain is incorrect. --gcc-toolchain
should be a path to riscv gnu toolchain installation.
I now receive an error at link time:
clang version 17.0.5 Target: riscv32-- Thread model: posix InstalledDir: /usr/local/bin/llvm/bin "/usr/local/bin/llvm/bin/clang-17" -cc1as -triple riscv32-- -filetype obj -main-file-name kernelFunction.s -target-cpu generic-rv32 -target-feature +a ......." /usr/bin/ld: unrecognised emulation mode: elf32lriscv Supported emulations: elf_x86_64 elf32_x86_64 elf_i386 elf_iamcu i386linux elf_l1om elf_k1om clang: error: ld command failed with exit code 1 (use -v to see invocation)
Thank you for your help !
Hi, I'm trying to generate an executable riscv binary (kernel.bin) from a riscv assembly code (kernel.s).
riscv-none-embed-as kernel.s -o kernel.o riscv-none-embed-ld kernel.o -o kernel.elf riscv-none-embed-objcopy -O binary kernel.elf kernel.bin
Maybe I'm using the wrong Clang/LLVM commands, or with the wrong arguments? I see that the two .elf files are different.
Thanks !