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