From acfac4f69e8ec9d3c018d8fdb61246fd9de2c0d7 Mon Sep 17 00:00:00 2001 From: aramya <22577625+thamugadi@users.noreply.github.com> Date: Tue, 4 Jul 2023 12:45:32 +0100 Subject: [PATCH] linker script --- Makefile | 4 ++-- linker.ld | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 linker.ld diff --git a/Makefile b/Makefile index e2c02a1..677608f 100644 --- a/Makefile +++ b/Makefile @@ -26,8 +26,8 @@ bootinfo.txt: loader/load.fth loader/def.fth cat loader/load.fth >> bootinfo.txt echo "" >> 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 $@ diff --git a/linker.ld b/linker.ld new file mode 100644 index 0000000..6bec2d9 --- /dev/null +++ b/linker.ld @@ -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) + } +}