1/*
2 * Copyright (c) 2009 Corey Tabaka
3 * Copyright (c) 2013 Travis Geiselbrecht
4 * Copyright (c) 2015 Intel Corporation
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files
8 * (the "Software"), to deal in the Software without restriction,
9 * including without limitation the rights to use, copy, modify, merge,
10 * publish, distribute, sublicense, and/or sell copies of the Software,
11 * and to permit persons to whom the Software is furnished to do so,
12 * subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be
15 * included in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 */
25
26ENTRY(_start)
27SECTIONS
28{
29    . = %KERNEL_BASE% + %KERNEL_LOAD_OFFSET%;
30
31    .text : AT(%MEMBASE% + %KERNEL_LOAD_OFFSET%) {
32        __code_start = .;
33        KEEP(*(.text.boot))
34        *(.text* .sram.text)
35        *(.gnu.linkonce.t.*)
36        __code_end = .;
37    } =0x9090
38
39    .rodata : ALIGN(4096) {
40        __rodata_start = .;
41        *(.rodata*)
42        *(.gnu.linkonce.r.*)
43        . = ALIGN(8);
44    }
45
46    /*
47     * extra linker scripts tend to insert sections just after .rodata,
48     * so we want to make sure this symbol comes after anything inserted above,
49     * but not aligned to the next section necessarily.
50     */
51    .dummy_post_rodata : {
52        __rodata_end = .;
53    }
54
55    .data : ALIGN(4096) {
56        __data_start = .;
57        *(.data .data.* .gnu.linkonce.d.*)
58    }
59
60    .ctors : ALIGN(4) {
61        __ctor_list = .;
62        KEEP(*(.ctors .init_array))
63        __ctor_end = .;
64    }
65    .dtors : ALIGN(4) {
66        __dtor_list = .;
67        KEEP(*(.dtors .fini_array))
68        __dtor_end = .;
69    }
70
71    .stab   : { *(.stab) }
72    .stabst : { *(.stabstr) }
73
74    /*
75     * extra linker scripts tend to insert sections just after .data,
76     * so we want to make sure this symbol comes after anything inserted above,
77     * but not aligned to the next section necessarily.
78     */
79    .dummy_post_data : {
80        __data_end = .;
81    }
82
83    .bss : ALIGN(4096) {
84        __bss_start = .;
85        *(.bss*)
86        *(.gnu.linkonce.b.*)
87        *(COMMON)
88        . = ALIGN(8);
89        __bss_end = .;
90    }
91
92    _end = .;
93
94    /* put a symbol arbitrarily 4MB past the end of the kernel */
95    /* used by the heap and other early boot time allocators */
96    _end_of_ram = . + (4*1024*1024);
97
98    /DISCARD/ : { *(.comment .note .eh_frame) }
99}
100