From dab51b1932cb82af152b0b6cbdb687083f79a290 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Sat, 28 Dec 2019 23:37:17 +0100 Subject: improve linking of PL0_test --- Makefile | 4 ++-- PL0_test.ld | 48 +++++++++--------------------------------------- 2 files changed, 11 insertions(+), 41 deletions(-) diff --git a/Makefile b/Makefile index 68368a5..e48dd2d 100644 --- a/Makefile +++ b/Makefile @@ -21,8 +21,8 @@ all : kernel.img %_embeddable.o : %.img arm-none-eabi-objcopy -I binary -O elf32-littlearm -B arm --rename-section .data=.rodata $^ $@ -PL_0_test.elf : PL0_test.o uart.o - arm-none-eabi-gcc -T PL0_test.ld -o $@ $(ELFFLAGS) $^ +PL_0_test.elf : PL0_test.ld PL0_test.o uart.o + arm-none-eabi-gcc -T $< -o $@ $(ELFFLAGS) PL0_test.o uart.o kernel_stage1.o : kernel_stage1.S kernel_stage2.img arm-none-eabi-as -mcpu=cortex-a7 $< -o $@ diff --git a/PL0_test.ld b/PL0_test.ld index 45bee5e..b1d06f4 100644 --- a/PL0_test.ld +++ b/PL0_test.ld @@ -1,49 +1,19 @@ -ENTRY(_start) - +/* linker script for creating the example userspace program PL0_test + */ + +/* no ENTRY() statement - this executable is run by jumping to it */ + SECTIONS { - /* 0b10101010101000000000000000000000 */ + /* my thought up address userspace programs should run from */ . = 0xaaa00000; - /* For some reason ld warns when _start is not defined. */ - /* Other .elf files link ok - only PL0_test.elf seems to */ - /* expect _start to be deifned. */ - _start = .; __start = .; - __text_start = .; - .text : + .another_weird_section_name_that_doesnt_matter : { /* have entry point at the beginning */ - KEEP(*(.text.PL0main)) - *(.text) + KEEP(PL0_test.o) + *(*) } - . = ALIGN(4096); /* align to page size */ - __text_end = .; - - __rodata_start = .; - .rodata : - { - *(.rodata) - } - . = ALIGN(4096); /* align to page size */ - __rodata_end = .; - - __data_start = .; - .data : - { - *(.data) - } - . = ALIGN(4096); /* align to page size */ - __data_end = .; - - __bss_start = .; - .bss : - { - bss = .; - *(.bss) - } - . = ALIGN(4096); /* align to page size */ - __bss_end = .; - __bss_size = __bss_end - __bss_start; __end = .; } -- cgit v1.2.3