source: trunk/libs/newlib/src/libgloss/mt/ms2.ld @ 444

Last change on this file since 444 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 10.2 KB
Line 
1OUTPUT_FORMAT("elf32-mt", "elf32-mt", "elf32-mt")
2OUTPUT_ARCH(mt)
3ENTRY(__boot_start)
4
5/* Do we need any of these for elf?
6   __DYNAMIC = 0;    */
7MEMORY
8{
9  ram (rwx) : ORIGIN = 0x0, LENGTH = 16M
10  sram (wx) : ORIGIN = 0xfef00000, LENGTH = 64K
11  frame-buffer (w) : ORIGIN = 0xff000000, LENGTH = 80K
12  dma-ram (w) : ORIGIN = 0x1000000, LENGTH = 32M
13  ports (w) : ORIGIN = 0xfffff000, LENGTH = 4K
14}
15SECTIONS
16{
17  /* Read-only sections, merged into text segment: */
18  . = 0x0;
19  PROVIDE(__executable_start = 0x0);
20  .interp         : { *(.interp) }
21  .hash           : { *(.hash) }
22  .dynsym         : { *(.dynsym) }
23  .dynstr         : { *(.dynstr) }
24  .gnu.version    : { *(.gnu.version) }
25  .gnu.version_d  : { *(.gnu.version_d) }
26  .gnu.version_r  : { *(.gnu.version_r) }
27  .rel.init       : { *(.rel.init) }
28  .rela.init      : { *(.rela.init) }
29  .rel.text       : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
30  .rela.text      : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
31  .rel.fini       : { *(.rel.fini) }
32  .rela.fini      : { *(.rela.fini) }
33  .rel.rodata     : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
34  .rela.rodata    : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
35  .rel.data.rel.ro  : { *(.rel.data.rel.ro*) }
36  .rela.data.rel.ro : { *(.rela.data.rel.ro*) }
37  .rel.data       : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
38  .rela.data      : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
39  .rel.tdata      : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
40  .rela.tdata     : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
41  .rel.tbss       : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
42  .rela.tbss      : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
43  .rel.ctors      : { *(.rel.ctors) }
44  .rela.ctors     : { *(.rela.ctors) }
45  .rel.dtors      : { *(.rel.dtors) }
46  .rela.dtors     : { *(.rela.dtors) }
47  .rel.got        : { *(.rel.got) }
48  .rela.got       : { *(.rela.got) }
49  .rel.sdata      : { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) }
50  .rela.sdata     : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) }
51  .rel.sbss       : { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) }
52  .rela.sbss      : { *(.rela.sbss .rela.sbss.* .rel.gnu.linkonce.sb.*) }
53  .rel.sdata2     : { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) }
54  .rela.sdata2    : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) }
55  .rel.sbss2      : { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) }
56  .rela.sbss2     : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) }
57  .rel.bss        : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
58  .rela.bss       : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
59  .rel.plt        : { *(.rel.plt) }
60  .rela.plt       : { *(.rela.plt) }
61
62  .startup        : { *startup-16-003.o(.startup) } >ram =0
63  . = 0x40;
64
65  .init           : { KEEP (*(.init)) } >ram =0
66  .plt            : { *(.plt) } >ram
67  .text           :
68  {
69    *startup-16-004.o(.text);
70    *(.text .stub .text.* .gnu.linkonce.t.*)
71    KEEP (*(.text.*personality*))
72    /* .gnu.warning sections are handled specially by elf32.em.  */
73    *(.gnu.warning)
74  } >ram =0
75  .fini           : { KEEP (*(.fini)) } >ram =0
76  PROVIDE (__etext = .);
77  PROVIDE (_etext = .);
78  PROVIDE (etext = .);
79  .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) } >ram
80  .rodata1        : { *(.rodata1) } >ram
81  .sdata2         : { *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) } >ram
82  .sbss2          : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) } >ram
83  .eh_frame_hdr   : { *(.eh_frame_hdr) } >ram
84  .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) } >ram
85  .gcc_except_table : ONLY_IF_RO { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) } >ram
86  /* Adjust the address for the data segment.  We want to adjust up to
87     the same address within the page on the next page up.  */
88  . = ALIGN(256) + (. & (256 - 1));
89  /* Exception handling  */
90  .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) } >ram
91  .gcc_except_table   : ONLY_IF_RW { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) } >ram
92  /* Thread Local Storage sections  */
93  .tdata          : { *(.tdata .tdata.* .gnu.linkonce.td.*) } >ram
94  .tbss           : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } >ram
95  /* Ensure the __preinit_array_start label is properly aligned.  We
96     could instead move the label definition inside the section, but
97     the linker would then create the section even if it turns out to
98     be empty, which isn't pretty.  */
99  . = ALIGN(32 / 8);
100  PROVIDE (__preinit_array_start = .);
101  .preinit_array  : { *(.preinit_array) } >ram
102  PROVIDE (__preinit_array_end = .);
103  PROVIDE (__init_array_start = .);
104  .init_array     : { *(.init_array) } >ram
105  PROVIDE (__init_array_end = .);
106  PROVIDE (__fini_array_start = .);
107  .fini_array     : { *(.fini_array) } >ram
108  PROVIDE (__fini_array_end = .);
109  .ctors          :
110  {
111    /* gcc uses crtbegin.o to find the start of
112       the constructors, so we make sure it is
113       first.  Because this is a wildcard, it
114       doesn't matter if the user does not
115       actually link against crtbegin.o; the
116       linker won't look for a file to match a
117       wildcard.  The wildcard also means that it
118       doesn't matter which directory crtbegin.o
119       is in.  */
120    KEEP (*crtbegin.o(.ctors))
121    /* We don't want to include the .ctor section from
122       from the crtend.o file until after the sorted ctors.
123       The .ctor section from the crtend file contains the
124       end of ctors marker and it must be last */
125    KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
126    KEEP (*(SORT(.ctors.*)))
127    KEEP (*(.ctors))
128  } >ram
129  .dtors          :
130  {
131    KEEP (*crtbegin*.o(.dtors))
132    KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
133    KEEP (*(SORT(.dtors.*)))
134    KEEP (*(.dtors))
135  } >ram
136  .jcr            : { KEEP (*(.jcr)) } >ram
137  .data.rel.ro    : { *(.data.rel.ro.local) *(.data.rel.ro*) } >ram
138  .dynamic        : { *(.dynamic) } >ram
139
140  /* DJK - Re-align the data section from the read-only section. */
141  . = ALIGN(16) + (. & (16 - 1));
142  PROVIDE (_data = .);
143  .data           :
144  {
145    *(.data .data.* .gnu.linkonce.d.*)
146    KEEP (*(.gnu.linkonce.d.*personality*))
147    SORT(CONSTRUCTORS)
148  } >ram
149  .data1          : { *(.data1) } >ram
150  .got            : { *(.got.plt) *(.got) } >ram
151
152  /* We want the small data sections together, so single-instruction offsets
153     can access them all, and initialized data all before uninitialized, so
154     we can shorten the on-disk segment size.  */
155  .sdata          : { *(.sdata .sdata.* .gnu.linkonce.s.*) } >ram
156  _edata = .;
157  PROVIDE ( edata = . );
158  .sbss           :
159  {
160    PROVIDE (__sbss_start = .);
161    PROVIDE (___sbss_start = .);
162    *(.dynsbss)
163    *(.sbss .sbss.* .gnu.linkonce.sb.*)
164    *(.scommon)
165    PROVIDE (__sbss_end = .);
166    PROVIDE (___sbss_end = .);
167  } >ram
168  .bss            :
169  {
170    *(.dynbss)
171    *(.bss .bss.* .gnu.linkonce.b.*)
172    *(COMMON)
173    /* Align here to ensure that the .bss section occupies space up to
174       _end.  Align after .bss to ensure correct alignment even if the
175      .bss section disappears because there are no input sections.  */
176    . = ALIGN(32 / 8);
177  } >ram
178  . = ALIGN(32 / 8);
179  __bss_start = ADDR ( .sbss ) ;
180  __bss_end = __bss_start + SIZEOF ( .sbss ) + SIZEOF ( .bss ) - 4 ;
181  _end = .;
182  PROVIDE (end = .);
183
184  /* DJK - Initialized frame buffer data is copied from RAM to FB. */
185  .auxbss         : AT (ADDR(.bss) + SIZEOF(.bss)) { *(.auxbss) } >frame-buffer
186  .auxdata        : AT (LOADADDR(.auxbss) + SIZEOF(.auxbss))
187  {
188    *(.auxdata.bank0)
189    . = ALIGN(0x4000);
190    *(.auxdata.bank1)
191    . = ALIGN(0x4000);
192    *(.auxdata.bank2)
193    . = ALIGN(0x4000);
194    *(.auxdata.bank3)
195    . = ALIGN(0x4000);
196    *(.auxdata.bank4)
197    *(.auxdata)
198  } >frame-buffer
199
200  _fbbss_start = ADDR ( .auxbss );
201  _fbbss_end = _fbbss_start + SIZEOF ( .auxbss ) - 4;
202  _fbdata_start = LOADADDR ( .auxdata );
203  _fbdata_end = _fbdata_start + SIZEOF ( .auxdata ) ;
204  _fbdata_vma = ADDR ( .auxdata );
205
206  PROVIDE (__FRAME_BUFFER_START = ADDR(.auxbss) );
207  PROVIDE (__FRAME_BUFFER_SIZE = 0x14000);
208  PROVIDE (__FRAME_BUFFER_END = __FRAME_BUFFER_START + __FRAME_BUFFER_SIZE);
209
210  /* For now, locate data ahead of code in onchip sram/memory. */
211  .sram           : AT (LOADADDR(.auxdata) + SIZEOF(.auxdata))
212  {
213    *(.sram.data)
214    . = ALIGN(4) ; /* Make sure that instructions are aligned... */
215    *(.sram.text)
216  } >sram
217 
218  _sram_data_start = LOADADDR ( .sram );
219  _sram_data_end = _sram_data_start + SIZEOF ( .sram ) ;
220  _sram_data_vma = ADDR ( .sram );
221
222  .dma            : { _dma_start = .; *(.dma) _dma_end = .; } >dma-ram
223  .internal_io (NOLOAD) : { *(.internal_io) } >ports
224
225  /* Stabs debugging sections.  */
226  .stab            0 : { *(.stab) }
227  .stabstr         0 : { *(.stabstr) }
228  .stab.excl       0 : { *(.stab.excl) }
229  .stab.exclstr    0 : { *(.stab.exclstr) }
230  .stab.index      0 : { *(.stab.index) }
231  .stab.indexstr   0 : { *(.stab.indexstr) }
232  .comment         0 : { *(.comment) }
233  /* DWARF debug sections.
234     Symbols in the DWARF debugging sections are relative to the beginning
235     of the section so we begin them at 0.  */
236  /* DWARF 1 */
237  .debug           0 : { *(.debug) }
238  .line            0 : { *(.line) }
239  /* GNU DWARF 1 extensions */
240  .debug_srcinfo   0 : { *(.debug_srcinfo) }
241  .debug_sfnames   0 : { *(.debug_sfnames) }
242  /* DWARF 1.1 and DWARF 2 */
243  .debug_aranges   0 : { *(.debug_aranges) }
244  .debug_pubnames  0 : { *(.debug_pubnames) }
245  /* DWARF 2 */
246  .debug_info      0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
247  .debug_abbrev    0 : { *(.debug_abbrev) }
248  .debug_line      0 : { *(.debug_line) }
249  .debug_frame     0 : { *(.debug_frame) }
250  .debug_str       0 : { *(.debug_str) }
251  .debug_loc       0 : { *(.debug_loc) }
252  .debug_macinfo   0 : { *(.debug_macinfo) }
253  /* SGI/MIPS DWARF 2 extensions */
254  .debug_weaknames 0 : { *(.debug_weaknames) }
255  .debug_funcnames 0 : { *(.debug_funcnames) }
256  .debug_typenames 0 : { *(.debug_typenames) }
257  .debug_varnames  0 : { *(.debug_varnames) }
258
259  /* In a multi-core environment, each core is given its own stack space
260     equal to __stack_size, growing downwards. */
261  PROVIDE (__stack = 0x97ff0);
262  PROVIDE (__stack_size = 0x800);
263
264  .stack (DEFINED(__stack) ? __stack : 0x007ffff0) :
265  {
266     __stack = .;
267    *(.stack)
268    LONG(0xdeaddead)
269  }
270  /DISCARD/ : { *(.note.GNU-stack) }
271}
Note: See TracBrowser for help on using the repository browser.