From 1f4fe94583b37183b44da0b54736867a153547f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Mon, 27 Jul 2009 16:21:20 +0000 Subject: [PATCH] [GSoC] [ARM] Patch by Johannes Wischert. LD scripts for u-boot based bootloader and the kernel. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31819 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../ldscripts/arm/boot_loader_u-boot.ld | 63 ++++++++++++++ src/system/ldscripts/arm/kernel.ld | 83 +++++++++++++++++++ 2 files changed, 146 insertions(+) create mode 100644 src/system/ldscripts/arm/boot_loader_u-boot.ld create mode 100644 src/system/ldscripts/arm/kernel.ld diff --git a/src/system/ldscripts/arm/boot_loader_u-boot.ld b/src/system/ldscripts/arm/boot_loader_u-boot.ld new file mode 100644 index 0000000000..8d90215c34 --- /dev/null +++ b/src/system/ldscripts/arm/boot_loader_u-boot.ld @@ -0,0 +1,63 @@ +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) + +ENTRY(_start) +SECTIONS +{ +/* . = 0x80008000; */ + . = 0xa2000000; + + /* text/read-only data */ + .text : { *(.text .gnu.linkonce.t.*) } + + . = ALIGN(0x4); + __ctor_list = .; + .ctors : { *(.ctors) } + __ctor_end = .; + + .rodata : { *(.rodata .rodata.*) } + + /* writable data */ + . = ALIGN(0x1000); + __data_start = .; + .data : { *(.data .gnu.linkonce.d.*) } + + /* unintialized data (in same segment as writable data) */ + __bss_start = .; + .bss : { *(.bss) } + + . = ALIGN(0x1000); + _end = . ; + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /* These must appear regardless of . */ + + /* Strip unnecessary stuff */ +/* /DISCARD/ : { *(.comment .note .eh_frame .dtors .stab .stabstr .debug*) }*/ +} diff --git a/src/system/ldscripts/arm/kernel.ld b/src/system/ldscripts/arm/kernel.ld new file mode 100644 index 0000000000..948f8fee25 --- /dev/null +++ b/src/system/ldscripts/arm/kernel.ld @@ -0,0 +1,83 @@ +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) + +ENTRY(_start) +SECTIONS +{ + . = 0x80500000; +/* . = 0x80000000;*/ + + .interp : { *(.interp) } + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .rel.text : { *(.rel.text) *(.rel.gnu.linkonce.t*) } + .rela.text : { *(.rela.text) *(.rela.gnu.linkonce.t*) } + .rel.data : { *(.rel.data) *(.rel.gnu.linkonce.d*) } + .rela.data : { *(.rela.data) *(.rela.gnu.linkonce.d*) } + .rel.rodata : { *(.rel.rodata) *(.rel.gnu.linkonce.r*) } + .rela.rodata : { *(.rela.rodata) *(.rela.gnu.linkonce.r*) } + .rel.got : { *(.rel.got) } + .rela.got : { *(.rela.got) } + .rel.ctors : { *(.rel.ctors) } + .rela.ctors : { *(.rela.ctors) } + .rel.dtors : { *(.rel.dtors) } + .rela.dtors : { *(.rela.dtors) } + .rel.init : { *(.rel.init) } + .rela.init : { *(.rela.init) } + .rel.fini : { *(.rel.fini) } + .rela.fini : { *(.rela.fini) } + .rel.bss : { *(.rel.bss) } + .rela.bss : { *(.rela.bss) } + .rel.plt : { *(.rel.plt) } + .rela.plt : { *(.rela.plt) } + .init : { *(.init) } =0x9090 + .plt : { *(.plt) } + + /* text/read-only data */ + .text : { *(.text .text.* .glue_7* .gnu.linkonce.t.*) } =0x9090 + + .rodata : { + *(.rodata .rodata.* .gnu.linkonce.r.*) + . = ALIGN(4); + __commands_start = .; + KEEP (*(.commands)) + __commands_end = .; + . = ALIGN(4); + __apps_start = .; + KEEP (*(.apps)) + __apps_end = .; + . = ALIGN(4); + __rodata_end = . ; + } + + /* writable data */ + __data_start_rom = .; /* in one segment binaries, the rom data address is on top of the ram data address */ + __data_start = .; + .data : SUBALIGN(4) { *(.data .data.* .gnu.linkonce.d.*) } + + __ctor_list = .; + .ctors : { *(.ctors) } + __ctor_end = .; + __dtor_list = .; + .dtors : { *(.dtors) } + __dtor_end = .; + .got : { *(.got.plt) *(.got) } + .dynamic : { *(.dynamic) } + + __data_end = .; + + /* unintialized data (in same segment as writable data) */ + . = ALIGN(4); + __bss_start = .; + .bss : { *(.bss .bss.*) } + + . = ALIGN(4); + _end = .; + +/* . = 0x80000000 + %MEMSIZE%; */ + _end_of_ram = .; + + /* Strip unnecessary stuff */ + /DISCARD/ : { *(.comment .note .eh_frame) } +}