• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
26_start_phys = _start - %KERNEL_BASE% + %MEMBASE%;
27ENTRY(_start_phys)
28SECTIONS
29{
30    . = %KERNEL_BASE% + %KERNEL_LOAD_OFFSET%;
31
32    .text : AT(%MEMBASE% + %KERNEL_LOAD_OFFSET%) {
33        __code_start = .;
34        KEEP(*(.text.boot))
35        *(.text* .sram.text)
36        *(.gnu.linkonce.t.*)
37        __code_end = .;
38    } =0x9090
39
40    .rodata : ALIGN(4096) {
41        __rodata_start = .;
42        __fault_handler_table_start = .;
43        KEEP(*(.rodata.fault_handler_table))
44        __fault_handler_table_end = .;
45        *(.rodata .rodata.* .gnu.linkonce.r.*)
46        . = ALIGN(8);
47    }
48
49    .ctors : ALIGN(4) {
50        __ctor_list = .;
51        KEEP(*(SORT_BY_INIT_PRIORITY(.ctors.*) SORT_BY_INIT_PRIORITY(.init_array.*)))
52        KEEP(*(.ctors .init_array))
53        __ctor_end = .;
54    }
55    .dtors : ALIGN(4) {
56        __dtor_list = .;
57        KEEP(*(SORT_BY_INIT_PRIORITY(.dtors.*) SORT_BY_INIT_PRIORITY(.fini_array.*)))
58        KEEP(*(.dtors .fini_array))
59        __dtor_end = .;
60    }
61
62    /*
63     * extra linker scripts tend to insert sections just after .rodata,
64     * so we want to make sure this symbol comes after anything inserted above,
65     * but not aligned to the next section necessarily.
66     */
67    .fake_post_rodata : {
68        __rodata_end = .;
69    }
70
71    .data : ALIGN(4096) {
72        __data_start = .;
73        *(.data .data.* .gnu.linkonce.d.*)
74    }
75
76    .stab   : { *(.stab) }
77    .stabst : { *(.stabstr) }
78
79    /*
80     * extra linker scripts tend to insert sections just after .data,
81     * so we want to make sure this symbol comes after anything inserted above,
82     * but not aligned to the next section necessarily.
83     */
84    .fake_post_data : {
85        __data_end = .;
86    }
87
88    .bss : ALIGN(4096) {
89        __bss_start = .;
90        *(.bss*)
91        *(.gnu.linkonce.b.*)
92        *(COMMON)
93        . = ALIGN(8);
94        __bss_end = .;
95    }
96
97    _end = .;
98
99    /* put a symbol arbitrarily 4MB past the end of the kernel */
100    /* used by the heap and other early boot time allocators */
101    _end_of_ram = . + (4*1024*1024);
102
103    /DISCARD/ : { *(.comment .note .eh_frame) }
104}
105