linker script

This commit is contained in:
aramya 2023-07-04 12:45:32 +01:00
parent cf35510749
commit acfac4f69e
2 changed files with 23 additions and 2 deletions

View File

@ -26,8 +26,8 @@ bootinfo.txt: loader/load.fth loader/def.fth
cat loader/load.fth >> bootinfo.txt
echo "</boot-script></chrp-boot>" >> bootinfo.txt
kernel.elf: $(OBJECTS)
$(PPC)-ld -Ttext=0x02000000 -Tdata=0x02100000 $^ -o $@
kernel.elf: linker.ld $(OBJECTS)
$(PPC)-ld -T $^ -o $@
%.elf: %.c
$(PPC)-gcc -I include -c $< -o $@

21
linker.ld Normal file
View File

@ -0,0 +1,21 @@
ENTRY(_start)
SECTIONS
{
. = 0x02000000;
.text BLOCK(4K) : ALIGN(4K)
{
*(.text)
}
. = 0x02100000;
.data BLOCK(4K) : ALIGN(4K)
{
*(.rodata)
*(.data)
}
.bss BLOCK(4K) (NOLOAD) : ALIGN(4K)
{
*(.bss)
}
}