Open esmil opened 4 years ago
I also needed CFLAGS += -fno-pic and LDFLAGS += -static to build on Ubuntu's riscv64 port.
Interesting. I just tried without on Bionic and it seems to build fine for me. But I don't mind adding it if it fixes stuff in your end and you've verified the output still works.
Interesting. I just tried without on Bionic and it seems to build fine for me. But I don't mind adding it if it fixes stuff in your end and you've verified the output still works.
yes please add -fno-pic many Linux distributions default toolchain to use PIE by default. The toolchains should be turning that off when freestanding specified, but sometimes that is buggy. Irrespective of what the toolchain/distro defaults are, building with -fno-pic is the right choice here, hence it is best to be explicit about it irrespective of what the toolchain defaults are.
This repo already contain implementations of memset, memcy, strcmp and strlen, so we just need our own copy of string.h to be able to use -ffreestanding.
This also means we can compile with a riscv64-linux-gnu toolchain which just an apt-get/dnf install/etc. away on most Linux distros.
I've tested this built with both riscv64-unknown-elf and riscv64-linux-gnu toolchains and my HFU still boots.