Commit | Line | Data |
---|---|---|
702d582e PG |
1 | /* Test linker script for OpenRISC. |
2 | ||
42a4f53d | 3 | Copyright (C) 2017-2019 Free Software Foundation, Inc. |
702d582e PG |
4 | |
5 | This program is free software; you can redistribute it and/or modify | |
6 | it under the terms of the GNU General Public License as published by | |
7 | the Free Software Foundation; either version 3 of the License, or | |
8 | (at your option) any later version. | |
9 | ||
10 | This program is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | GNU General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU General Public License | |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |
17 | ||
18 | MEMORY | |
19 | { | |
20 | /* The exception vectors actually start at 0x100, but if you specify | |
21 | that address here, the "--output-target binary" step will start from | |
22 | address 0 with the contents meant for address 0x100. */ | |
23 | exception_vectors : ORIGIN = 0 , LENGTH = 8K | |
24 | ram : ORIGIN = 8K, LENGTH = 2M - 8K | |
25 | } | |
26 | ||
27 | SECTIONS | |
28 | { | |
29 | .exception_vectors : | |
30 | { | |
31 | KEEP(*(.exception_vectors)) | |
32 | } > exception_vectors | |
33 | ||
34 | .text : | |
35 | { | |
36 | *(.text) | |
37 | *(.text.*) | |
38 | *(.rodata) | |
39 | *(.rodata.*) | |
40 | } > ram | |
41 | ||
42 | .data : | |
43 | { | |
44 | *(.data) | |
45 | *(.data.*) | |
46 | } > ram | |
47 | ||
48 | .bss : | |
49 | { | |
50 | *(.bss) | |
51 | *(.bss.*) | |
52 | ||
53 | /* WARNING about section size alignment: | |
54 | The start-up assembly code can only clear BSS section sizes | |
55 | which are aligned to 4 bytes. However, the size of the BSS | |
56 | section may not be aligned, therefore up to 3 bytes more could | |
57 | be zeroed on start-up. This is normally not an issue, as the | |
58 | start of the next section is usually aligned too, so those extra | |
59 | bytes should be just padding. I did try the following trick to | |
60 | align the BSS section size, to no avail: | |
61 | ||
62 | . = ALIGN(., 4); | |
63 | */ | |
64 | } > ram | |
65 | ||
66 | _bss_begin = ADDR(.bss); | |
67 | _bss_end = _bss_begin + SIZEOF(.bss); | |
68 | ||
69 | .stack ALIGN(16) (NOLOAD): | |
70 | { | |
71 | *(.stack) | |
72 | } > ram | |
73 | } | |
74 | ||
75 | ENTRY(_start) /* Otherwise, --gc-sections would throw everything away. */ |