Relocations are working

This commit is contained in:
2026-02-27 09:11:57 +01:00
parent 79b75dc75b
commit c3eb93e701
6 changed files with 84 additions and 25 deletions

View File

@@ -12,11 +12,11 @@ sync_filesystem:
sync
build_user_prog prog:
RUSTFLAGS="-C relocation-model=pic -C link-arg=-Tuser.ld" cargo b {{ cargo_flags }} --package {{ prog }}
# cp {{ bin_path / prog }} {{ "mnt/usr/bin" / prog }}
riscv64-elf-objcopy -O binary {{ bin_path / prog }} {{ "mnt/usr/bin" / prog }}
RUSTFLAGS="-C relocation-model=pic -C link-arg=-Tuser.ld -C link-arg=-pie" cargo b {{ cargo_flags }} --package {{ prog }}
cp {{ bin_path / prog }} {{ "mnt/usr/bin" / prog }}
# riscv64-elf-objcopy -O binary {{ bin_path / prog }} {{ "mnt/usr/bin" / prog }}
build: mount_filesystem (map_dir "user" "build_user_prog")
build: mount_filesystem (map_dir "user" f"just cargo_flags=\"{{cargo_flags}}\" build_user_prog")
cargo b {{ cargo_flags }}
just sync_filesystem
@@ -25,7 +25,7 @@ run: build
map_dir dir recipe:
@for file in `ls {{ dir }}`; do \
just cargo_flags="{{ cargo_flags }}" {{ recipe }} $file ; \
{{ recipe }} $file ; \
done
qemu := "qemu-system-riscv64 -machine virt -device bochs-display -bios none -m 512M -device loader,file=disk.img,addr=0x90000000"