1OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
2OUTPUT_ARCH(arm)
3
4ENTRY(_start)
5SECTIONS
6{
7    . = %KERNEL_BASE% + %KERNEL_LOAD_OFFSET%;
8
9    _start = .;
10
11    /* text/read-only data */
12    /* set the load address to physical MEMBASE */
13    .text : AT(%MEMBASE% + %KERNEL_LOAD_OFFSET%) {
14        KEEP(*(.text.boot.vectab1))
15        KEEP(*(.text.boot.vectab2))
16        KEEP(*(.text.boot))
17        *(.text* .sram.text.glue_7* .gnu.linkonce.t.*)
18    }
19
20    .interp : { *(.interp) }
21    .hash : { *(.hash) }
22    .dynsym : { *(.dynsym) }
23    .dynstr : { *(.dynstr) }
24    .rel.text : { *(.rel.text) *(.rel.gnu.linkonce.t*) }
25    .rela.text : { *(.rela.text) *(.rela.gnu.linkonce.t*) }
26    .rel.data : { *(.rel.data) *(.rel.gnu.linkonce.d*) }
27    .rela.data : { *(.rela.data) *(.rela.gnu.linkonce.d*) }
28    .rel.rodata : { *(.rel.rodata) *(.rel.gnu.linkonce.r*) }
29    .rela.rodata : { *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
30    .rel.got : { *(.rel.got) }
31    .rela.got : { *(.rela.got) }
32    .rel.ctors : { *(.rel.ctors) }
33    .rela.ctors : { *(.rela.ctors) }
34    .rel.dtors : { *(.rel.dtors) }
35    .rela.dtors : { *(.rela.dtors) }
36    .rel.init : { *(.rel.init) }
37    .rela.init : { *(.rela.init) }
38    .rel.fini : { *(.rel.fini) }
39    .rela.fini : { *(.rela.fini) }
40    .rel.bss : { *(.rel.bss) }
41    .rela.bss : { *(.rela.bss) }
42    .rel.plt : { *(.rel.plt) }
43    .rela.plt : { *(.rela.plt) }
44    .init : { *(.init) } =0x9090
45    .plt : { *(.plt) }
46
47    /* .ARM.exidx is sorted, so has to go in its own output section.  */
48    __exidx_start = .;
49    .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) }
50    __exidx_end = .;
51
52    .rodata : ALIGN(4) {
53        __rodata_start = .;
54        __fault_handler_table_start = .;
55        KEEP(*(.rodata.fault_handler_table))
56        __fault_handler_table_end = .;
57        *(.rodata .rodata.* .gnu.linkonce.r.*)
58    }
59
60    /*
61     * extra linker scripts tend to insert sections just after .rodata,
62     * so we want to make sure this symbol comes after anything inserted above,
63     * but not aligned to the next section necessarily.
64     */
65    .dummy_post_rodata : {
66        __rodata_end = .;
67    }
68
69    .data : ALIGN(4) {
70        /* writable data  */
71        __data_start_rom = .;
72        /* in one segment binaries, the rom data address is on top of the ram data address */
73        __data_start = .;
74        *(.data .data.* .gnu.linkonce.d.*)
75    }
76
77    .ctors : ALIGN(4) {
78        __ctor_list = .;
79        KEEP(*(.ctors .init_array))
80        __ctor_end = .;
81    }
82    .dtors : ALIGN(4) {
83        __dtor_list = .;
84        KEEP(*(.dtors .fini_array))
85        __dtor_end = .;
86    }
87    .got : { *(.got.plt) *(.got) }
88    .dynamic : { *(.dynamic) }
89
90    /*
91     * extra linker scripts tend to insert sections just after .data,
92     * so we want to make sure this symbol comes after anything inserted above,
93     * but not aligned to the next section necessarily.
94     */
95    .dummy_post_data : {
96        __data_end = .;
97    }
98
99    /* uninitialized data (in same segment as writable data) */
100    .bss : ALIGN(4) {
101        KEEP(*(.bss.prebss.*))
102        . = ALIGN(4);
103        __bss_start = .;
104        *(.bss .bss.*)
105        *(.gnu.linkonce.b.*)
106        *(COMMON)
107        . = ALIGN(4);
108        __bss_end = .;
109    }
110
111    _end = .;
112
113    . = %KERNEL_BASE% + %MEMSIZE%;
114    _end_of_ram = .;
115
116    /* Strip unnecessary stuff */
117    /DISCARD/ : { *(.comment .note .eh_frame) }
118}
119