blob: eea882db79da7fda50265e723693602ce0c0170a [file] [log] [blame]
swissChili56cf8172022-07-30 18:47:48 -07001OUTPUT_ARCH( "riscv" )
2
3ENTRY( _start )
4
5SECTIONS
6{
7 .header : AT(0)
8 {
9 _irom_start = .;
10 LONG(0xaedb041d)
11 LONG(0xaedb041d)
12 } > irom
13
14 .text.entry ORIGIN(irom) + 8 :
15 {
16 KEEP(*(.text.entry))
17 } > irom
18
19 .text :
20 {
21 *(.text .stub .text.* .gnu.linkonce.t.*)
22 *(.gnu.warning)
23 }
24 . = ALIGN(4);
25 PROVIDE (__etext = .);
26 PROVIDE (_etext = .);
27 PROVIDE (etext = .);
28 _irom_size = . - _irom_start;
29
30 _drom_start = ORIGIN(drom) + _irom_size;
31 .rodata _drom_start : AT(_irom_size)
32 {
33 *(.rodata .rodata.* .gnu.linkonce.r.*)
34 } > drom
35
36 .rodata1 :
37 {
38 *(.rodata1)
39 }
40
41 .init_array :
42 {
43 PROVIDE_HIDDEN (__init_array_start = .);
44 KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
45 KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))
46 PROVIDE_HIDDEN (__init_array_end = .);
47 } > drom
48
49 .fini_array :
50 {
51 PROVIDE_HIDDEN (__fini_array_start = .);
52 KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
53 KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))
54 PROVIDE_HIDDEN (__fini_array_end = .);
55 } > drom
56
57 .ctors :
58 {
59 KEEP (*crtbegin.o(.ctors))
60 KEEP (*crtbegin?.o(.ctors))
61 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
62 KEEP (*(SORT(.ctors.*)))
63 KEEP (*(.ctors))
64 }
65
66 .dtors :
67 {
68 KEEP (*crtbegin.o(.dtors))
69 KEEP (*crtbegin?.o(.dtors))
70 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
71 KEEP (*(SORT(.dtors.*)))
72 KEEP (*(.dtors))
73 }
74
75 _drom_size = . - _drom_start;
76
77 .data ORIGIN(ram) : AT(_irom_size + _drom_size)
78 {
79 _data_start = .;
80 __DATA_BEGIN__ = .;
81 *(.data .data.* .gnu.linkonce.d.*)
82 *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*)
83 SORT(CONSTRUCTORS)
84 } > ram
85 .data1 :
86 {
87 *(.data1)
88 }
89 .sdata :
90 {
91 __SDATA_BEGIN__ = .;
92 *(.srodata.cst16) *(.srodata.cst8) *(.srodata.cst4) *(.srodata.cst2) *(.srodata .srodata.*)
93 *(.sdata .sdata.* .gnu.linkonce.s.*)
94 }
95 . = ALIGN(4);
96 _edata = .; PROVIDE (edata = .);
97 _data_lma = ORIGIN(drom) + LOADADDR(.data);
98 _data_size = _edata - _data_start;
99
100 __bss_start = .;
101 .sbss :
102 {
103 *(.dynsbss)
104 *(.sbss .sbss.* .gnu.linkonce.sb.*)
105 *(.scommon)
106 }
107 .bss :
108 {
109 *(.dynbss)
110 *(.bss .bss.* .gnu.linkonce.b.*)
111 *(COMMON)
112 }
113 . = ALIGN(4);
114 __BSS_END__ = .;
115 __global_pointer$ = MIN(__SDATA_BEGIN__ + 0x800,
116 MAX(__DATA_BEGIN__ + 0x800, __BSS_END__ - 0x800));
117 _end = .; PROVIDE (end = .);
118
119 /* Stack */
120 .stack :
121 {
122 __stack_bottom = .;
123 __stack_top = ORIGIN(ram) + LENGTH(ram);
124 __stack_size_min = 0x4000;
125 ASSERT(__stack_bottom + __stack_size_min < __stack_top, "Error: no space for stack");
126 }
127
128 /* Stabs debugging sections. */
129 .stab 0 : { *(.stab) }
130 .stabstr 0 : { *(.stabstr) }
131 .stab.excl 0 : { *(.stab.excl) }
132 .stab.exclstr 0 : { *(.stab.exclstr) }
133 .stab.index 0 : { *(.stab.index) }
134 .stab.indexstr 0 : { *(.stab.indexstr) }
135 .comment 0 : { *(.comment) }
136 .gnu.build.attributes : { *(.gnu.build.attributes .gnu.build.attributes.*) }
137 /* DWARF debug sections.
138 Symbols in the DWARF debugging sections are relative to the beginning
139 of the section so we begin them at 0. */
140 /* DWARF 1 */
141 .debug 0 : { *(.debug) }
142 .line 0 : { *(.line) }
143 /* GNU DWARF 1 extensions */
144 .debug_srcinfo 0 : { *(.debug_srcinfo) }
145 .debug_sfnames 0 : { *(.debug_sfnames) }
146 /* DWARF 1.1 and DWARF 2 */
147 .debug_aranges 0 : { *(.debug_aranges) }
148 .debug_pubnames 0 : { *(.debug_pubnames) }
149 /* DWARF 2 */
150 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
151 .debug_abbrev 0 : { *(.debug_abbrev) }
152 .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end) }
153 .debug_frame 0 : { *(.debug_frame) }
154 .debug_str 0 : { *(.debug_str) }
155 .debug_loc 0 : { *(.debug_loc) }
156 .debug_macinfo 0 : { *(.debug_macinfo) }
157 /* SGI/MIPS DWARF 2 extensions */
158 .debug_weaknames 0 : { *(.debug_weaknames) }
159 .debug_funcnames 0 : { *(.debug_funcnames) }
160 .debug_typenames 0 : { *(.debug_typenames) }
161 .debug_varnames 0 : { *(.debug_varnames) }
162 /* DWARF 3 */
163 .debug_pubtypes 0 : { *(.debug_pubtypes) }
164 .debug_ranges 0 : { *(.debug_ranges) }
165 /* DWARF Extension. */
166 .debug_macro 0 : { *(.debug_macro) }
167 .debug_addr 0 : { *(.debug_addr) }
168 .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
169 /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
170}