Hi all,
I get the following error after running the baremetal code [link.ld,init.S,systemcalls.c]
root@user:/home/user# clang -mcmodel=medany -ffunction-sections -fdata-sections -ffreestanding /home/user/Downloads/riscv-master/demo/baremetal/init.s -fuse-ld=ld -mno-relax --gcc-toolchain=$(RISCV) -march=rv64gc -o kernel_baseline --rtlib=libgcc -static -nostdlib -nostartfiles -Wl,-L/usr/bin/ld -Wl,-T/home/user/Downloads/riscv-master/demo/baremetal/link.ld -lm -lgcc /home/user/Downloads/riscv-master/demo/baremetal/syscalls.c -o /home/user/Desktop/bare.elf
RISCV: command not found
/home/user/Documents/riscv/_install/bin/riscv64-unknown-elf-ld: cannot find -lgcc: No such file or directory
clang-14: error: ld command failed with exit code 1 (use -v to see invocation)
root@user-ML:/home/user# clang -mcmodel=medany -ffunction-sections -fdata-sections -ffreestanding /home/user/Downloads/riscv-master/demo/baremetal/init.s -fuse-ld=ld -mno-relax --gcc-toolchain=$(RISCV) -march=rv64gc -o kernel_baseline --rtlib=libgcc -static -nostdlib -nostartfiles -Wl,-L/usr/bin/ld -Wl,-T/home/user/Downloads/riscv-master/demo/baremetal/link.ld -lm -lgcc /home/user/Downloads/riscv-master/demo/baremetal/syscalls.c -o /home/user/Desktop/bare.elf -v
RISCV: command not found
clang version 14.0.6 (GitHub - llvm/llvm-project: The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. Note: the repository does not accept github pull requests at this moment. Please submit your patches at http://reviews.llvm.org. f28c006a5895fc0e329fe15fead81e37457cb1d1)
Target: riscv64-unknown-unknown-elf
Thread model: posix
InstalledDir: /usr/local/bin
“/usr/local/bin/clang-14” -cc1as -triple riscv64-unknown-unknown-elf -filetype obj -main-file-name init.s -target-feature +m -target-feature +a -target-feature +f -target-feature +d -target-feature +c -target-feature -relax -target-feature -save-restore -fdebug-compilation-dir=/home/user -dwarf-debug-producer “clang version 14.0.6 (GitHub - llvm/llvm-project: The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. Note: the repository does not accept github pull requests at this moment. Please submit your patches at http://reviews.llvm.org. f28c006a5895fc0e329fe15fead81e37457cb1d1)” -dwarf-version=5 -mrelocation-model static -target-abi lp64d -mrelax-all --mrelax-relocations -o /tmp/init-4a0936.o /home/user/Downloads/riscv-master/demo/baremetal/init.s
“/usr/local/bin/clang-14” -cc1 -triple riscv64-unknown-unknown-elf -emit-obj -mrelax-all --mrelax-relocations -disable-free -clear-ast-before-backend -main-file-name syscalls.c -static-define -mrelocation-model static -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -ffreestanding -nostdsysteminc -mcmodel=medium -target-feature +m -target-feature +a -target-feature +f -target-feature +d -target-feature +c -target-feature -relax -target-feature -save-restore -target-abi lp64d -msmall-data-limit 8 -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=gdb -v -ffunction-sections -fdata-sections -fcoverage-compilation-dir=/home/user -resource-dir /usr/local/lib/clang/14.0.6 -isysroot /home/user/Documents/riscv/_install/riscv64-unknown-elf/ -internal-isystem /home/user/Documents/riscv/_install/riscv64-unknown-elf/include -fdebug-compilation-dir=/home/user -ferror-limit 19 -fno-signed-char -fgnuc-version=4.2.1 -fcolor-diagnostics -faddrsig -o /tmp/syscalls-399666.o -x c /home/user/Downloads/riscv-master/demo/baremetal/syscalls.c
clang -cc1 version 14.0.6 based upon LLVM 14.0.6 default target riscv64-unknown-elf
#include “…” search starts here:
#include <…> search starts here:
/home/user/Documents/riscv/_install/riscv64-unknown-elf/include
/usr/local/lib/clang/14.0.6/include
End of search list.
“/home/user/Documents/riscv/_install/bin/riscv64-unknown-elf-ld” --sysroot=/home/user/Documents/riscv/_install/riscv64-unknown-elf/ -m elf64lriscv /tmp/init-4a0936.o -L/usr/bin/ld -T/home/user/Downloads/riscv-master/demo/baremetal/link.ld -lm -lgcc /tmp/syscalls-399666.o -L/home/user/Documents/riscv/_install/riscv64-unknown-elf//lib -o /home/user/Desktop/bare.elf
/home/user/Documents/riscv/_install/bin/riscv64-unknown-elf-ld: cannot find -lgcc: No such file or directory
It would be very helpful if we could run this.