diff options
author | Jean-Philippe Brucker <jean-philippe.brucker@arm.com> | 2015-12-01 19:51:56 +0000 |
---|---|---|
committer | Mark Rutland <mark.rutland@arm.com> | 2016-06-14 17:49:16 +0100 |
commit | 972310147bb45d7f0c0530313ac28125fe9b70fe (patch) | |
tree | 017c6f6f1e7ca116b1a5e6a9b3b39567cd13dbc7 | |
parent | 8aca634eda45e13d653fe41109d70dbbc2c3cf17 (diff) | |
download | boot-wrapper-aarch64-972310147bb45d7f0c0530313ac28125fe9b70fe.tar.gz |
Make the linker script more generic
Attempt to make the linker script more flexible, by removing explicit
object names. We move boot code into a ".init" section, and let ld freely
reorganize the rest.
Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | boot.S | 2 | ||||
-rw-r--r-- | model.lds.S | 57 |
3 files changed, 34 insertions, 27 deletions
diff --git a/Makefile.am b/Makefile.am index b1b9a4f..c2447ad 100644 --- a/Makefile.am +++ b/Makefile.am @@ -93,7 +93,7 @@ $(IMAGE): $(OFILES) model.lds fdt.dtb $(KERNEL_IMAGE) $(FILESYSTEM) $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c -o $@ $< model.lds: $(LD_SCRIPT) Makefile - $(CPP) $(CPPFLAGS) -ansi -DPHYS_OFFSET=$(PHYS_OFFSET) -DMBOX_OFFSET=$(MBOX_OFFSET) -DKERNEL_OFFSET=$(KERNEL_OFFSET) -DFDT_OFFSET=$(FDT_OFFSET) -DFS_OFFSET=$(FS_OFFSET) -DKERNEL=$(KERNEL_IMAGE) -DFILESYSTEM=$(FILESYSTEM) -DBOOTMETHOD=$(BOOTMETHOD) -DGIC=$(GIC) -P -C -o $@ $< + $(CPP) $(CPPFLAGS) -ansi -DPHYS_OFFSET=$(PHYS_OFFSET) -DMBOX_OFFSET=$(MBOX_OFFSET) -DKERNEL_OFFSET=$(KERNEL_OFFSET) -DFDT_OFFSET=$(FDT_OFFSET) -DFS_OFFSET=$(FS_OFFSET) -DKERNEL=$(KERNEL_IMAGE) -DFILESYSTEM=$(FILESYSTEM) -P -C -o $@ $< fdt.dtb: $(KERNEL_DTB) Makefile gen-cpu-nodes.sh ( $(DTC) -O dts -I dtb $(KERNEL_DTB) ; echo "/ { $(CHOSEN_NODE) $(PSCI_NODE) $(CPUS_NODE) };" ) | $(DTC) -O dtb -o $@ - @@ -9,7 +9,7 @@ #include "common.S" - .text + .section .init .globl _start _start: diff --git a/model.lds.S b/model.lds.S index 3d012ee..504f3b9 100644 --- a/model.lds.S +++ b/model.lds.S @@ -18,34 +18,41 @@ INPUT(./fdt.dtb) INPUT(FILESYSTEM) #endif +ENTRY(_start) + SECTIONS { - . = PHYS_OFFSET; - .text : { boot.o(.text .data) } - .text : { cache.o(.text .data) } - .text : { GIC(.text .data) } - .text : { mmu.o(.text .data) } - .text : { ns.o(.text) } - .text : { BOOTMETHOD(.text .data) } - .text : { *(.vectors) } - .text : { *(.pgtables) } - . = PHYS_OFFSET + MBOX_OFFSET; - mbox = .; - .mbox : { QUAD(0x0) } - . = PHYS_OFFSET + KERNEL_OFFSET; - kernel = .; - .kernel : { KERNEL } - - . = PHYS_OFFSET + FDT_OFFSET; - dtb = .; - .dtb : { ./fdt.dtb } - . = PHYS_OFFSET + FS_OFFSET; - filesystem = .; + /* + * Order matters: consume binary blobs first, so they won't appear in + * the boot section's *(.data) + */ + .kernel (PHYS_OFFSET + KERNEL_OFFSET): { + kernel = .; + KERNEL + } + + .dtb (PHYS_OFFSET + FDT_OFFSET): { + dtb = .; + ./fdt.dtb + } + #ifdef USE_INITRD - .filesystem : { FILESYSTEM } - fs_size = . - filesystem; + .filesystem (PHYS_OFFSET + FS_OFFSET): { + filesystem = .; + FILESYSTEM + fs_size = . - filesystem; + } #endif - .data : { *(.data) } - .bss : { *(.bss) } + .boot PHYS_OFFSET: { + *(.init) + *(.text .data .rodata* .bss COMMON) + *(.vectors) + *(.pgtables) + } + + .mbox (PHYS_OFFSET + MBOX_OFFSET): { + mbox = .; + QUAD(0x0) + } } |