OSDN Git Service

c7e01a6f978d427816c86d719baae15a1bdce28a
[uclinux-h8/elf2flt.git] / elf2flt.ld.in
1
2 ENTRY (@SYMBOL_PREFIX@_start)
3
4 MEMORY {
5         flatmem : ORIGIN = 0x0, LENGTH = 0xfffffff
6 }
7
8 PHDRS {
9         text PT_LOAD ;
10         data PT_LOAD ;
11 }
12
13 SECTIONS {
14
15         .text 0x0 : {
16                 . = . + 4;
17                 . = ALIGN(0x4) ;
18                 @SYMBOL_PREFIX@_stext = . ;
19                 *(.text)
20                 *(.text.*)
21                 *(.gnu.warning)
22                 *(.stub)
23                 *(.gnu.linkonce.t*)
24                 *(.glue_7t)
25                 *(.glue_7)
26                 *(.jcr)
27                 KEEP (*(.init))
28                 KEEP (*(.fini))
29
30 W_RODAT         *(.rodata)
31 W_RODAT         *(.rodata1)
32 W_RODAT         *(.rodata.*)
33 W_RODAT         *(.gnu.linkonce.r*)
34
35                 /* This is special code area at the end of the normal
36                    text section.  It contains a small lookup table at
37                    the start followed by the code pointed to by entries
38                    in the lookup table.  */
39                 . = ALIGN (4) ;
40                 PROVIDE(@SYMBOL_PREFIX@__ctbp = .);
41                 *(.call_table_data)
42                 *(.call_table_text)
43
44                 . = ALIGN(0x20) ;
45                 @SYMBOL_PREFIX@_etext = . ;
46         } > flatmem :text
47
48         .data : {
49                 . = ALIGN(0x4) ;
50                 @SYMBOL_PREFIX@_sdata = . ;
51                 @SYMBOL_PREFIX@__data_start = . ;
52                 @SYMBOL_PREFIX@data_start = . ;
53                 *(.got.plt)
54                 *(.got)
55                 FILL(0) ;
56                 . = ALIGN(0x20) ;
57                 LONG(-1)
58                 . = ALIGN(0x20) ;
59 R_RODAT         *(.rodata)
60 R_RODAT         *(.rodata1)
61 R_RODAT         *(.rodata.*)
62 R_RODAT         *(.gnu.linkonce.r*)
63                 *(.data)
64                 *(.data1)
65                 *(.data.*)
66                 *(.gnu.linkonce.d*)
67
68                 /* Microblaze has .sdata and .sbss (small bss).  They must
69                    be contiguous, so please don't move any of this. JW */
70                 @SYMBOL_PREFIX@_ssrw = . ;
71                 *(.sdata)
72                 *(.sdata.*)
73                 *(.sbss)                        /* Don't move this! */
74                 *(.gnu.linkonce.sb*)
75                 @SYMBOL_PREFIX@_essrw = . ;
76
77                 @SYMBOL_PREFIX@_ssrw_size = @SYMBOL_PREFIX@_essrw - @SYMBOL_PREFIX@_ssrw;
78                 PROVIDE(@SYMBOL_PREFIX@_SDA_BASE_ = @SYMBOL_PREFIX@_ssrw + (@SYMBOL_PREFIX@_ssrw_size / 2));
79
80                 *(.gnu.linkonce.s.*)
81                 *(__libc_atexit)
82                 *(__libc_subinit)
83                 *(__libc_subfreeres)
84
85                 /* microblaze-specific read-only small data area
86                    and associated locating symbols */
87                 @SYMBOL_PREFIX@_ssro = . ;
88                 *(.sdata2)
89                 @SYMBOL_PREFIX@_essro = . ;
90                 @SYMBOL_PREFIX@_ssro_size = @SYMBOL_PREFIX@_essro - @SYMBOL_PREFIX@_ssro;
91                 PROVIDE(@SYMBOL_PREFIX@_SDA2_BASE_ = @SYMBOL_PREFIX@_ssro + (@SYMBOL_PREFIX@_ssro_size / 2));
92
93                 . = ALIGN(4) ;
94 TOR:            @SYMBOL_PREFIX@__CTOR_LIST__ = .;
95 TOR:            LONG((@SYMBOL_PREFIX@__CTOR_END__ - @SYMBOL_PREFIX@__CTOR_LIST__) / 4 - 2)
96 SINGLE_LINK:    /* gcc uses crtbegin.o to find the start of
97 SINGLE_LINK:       the constructors, so we make sure it is
98 SINGLE_LINK:       first.  Because this is a wildcard, it
99 SINGLE_LINK:       doesn't matter if the user does not
100 SINGLE_LINK:       actually link against crtbegin.o; the
101 SINGLE_LINK:       linker won't look for a file to match a
102 SINGLE_LINK:       wildcard.  The wildcard also means that it
103 SINGLE_LINK:       doesn't matter which directory crtbegin.o
104 SINGLE_LINK:       is in.  */
105 SINGLE_LINK:    KEEP (*crtbegin*.o(.ctors))
106 SINGLE_LINK:    /* We don't want to include the .ctor section from
107 SINGLE_LINK:       from the crtend.o file until after the sorted ctors.
108 SINGLE_LINK:       The .ctor section from the crtend file contains the
109 SINGLE_LINK:       end of ctors marker and it must be last */
110 SINGLE_LINK:    KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
111 SINGLE_LINK:    KEEP (*(SORT(.ctors.*)))
112                 KEEP (*(.ctors))
113 TOR:            LONG(0)
114 TOR:            @SYMBOL_PREFIX@__CTOR_END__ = .;
115 TOR:            @SYMBOL_PREFIX@__DTOR_LIST__ = .;
116 TOR:            LONG((@SYMBOL_PREFIX@__DTOR_END__ - @SYMBOL_PREFIX@__DTOR_LIST__) / 4 - 2)
117 SINGLE_LINK:    KEEP (*crtbegin*.o(.dtors))
118 SINGLE_LINK:    KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
119 SINGLE_LINK:    KEEP (*(SORT(.dtors.*)))
120                 KEEP (*(.dtors))
121 TOR:            LONG(0)
122 TOR:            @SYMBOL_PREFIX@__DTOR_END__ = .;
123
124                 PROVIDE (@SYMBOL_PREFIX@__preinit_array_start = .);
125                 KEEP (*(.preinit_array))
126                 PROVIDE (@SYMBOL_PREFIX@__preinit_array_end = .);
127
128                 PROVIDE (@SYMBOL_PREFIX@__init_array_start = .);
129                 KEEP (*(SORT(.init_array.*)))
130                 KEEP (*(.init_array))
131                 PROVIDE (@SYMBOL_PREFIX@__init_array_end = .);
132
133                 PROVIDE (@SYMBOL_PREFIX@__fini_array_start = .);
134                 KEEP (*(.fini_array))
135                 KEEP (*(SORT(.fini_array.*)))
136                 PROVIDE (@SYMBOL_PREFIX@__fini_array_end = .);
137         } > flatmem :data
138
139         .note.ABI-tag : { *(.note.ABI-tag) } > flatmem
140         .eh_frame_hdr : { *(.eh_frame_hdr) } > flatmem
141         .eh_frame : { KEEP(*(.eh_frame)) } > flatmem
142         .gcc_except_table : {
143                 KEEP(*(.gcc_except_table))
144                 KEEP(*(.gcc_except_table.*))
145         } >flatmem
146
147         . = ALIGN(0x10) ;
148         @SYMBOL_PREFIX@_edata = . ;
149
150         .bss : {
151                 . = ALIGN(0x4) ;
152                 @SYMBOL_PREFIX@_sbss = ALIGN(0x4) ;
153                 @SYMBOL_PREFIX@__bss_start = . ;
154                 *(.dynsbss)
155                 *(.sbss)
156                 *(.sbss.*)
157                 *(.scommon)
158                 *(.dynbss)
159                 *(.bss)
160                 *(.bss.*)
161                 *(.bss*)
162                 *(.gnu.linkonce.b*)
163                 *(COMMON)
164                 . = ALIGN(0x10) ;
165                 @SYMBOL_PREFIX@_ebss = . ;
166                 @SYMBOL_PREFIX@_end = . ;
167                 @SYMBOL_PREFIX@end = . ;
168         } > flatmem
169
170         .stack : {
171                 . = ALIGN(0x4);
172                 @SYMBOL_PREFIX@_stack_start = .;
173         }
174
175         .junk 0 : { *(.rel*) *(.rela*) }
176         /DISCARD/ : { *(.note.GNU-stack) }
177         /* Stabs debugging sections.    */
178         .stab 0 : { *(.stab) }
179         .stabstr 0 : { *(.stabstr) }
180         .stab.excl 0 : { *(.stab.excl) }
181         .stab.exclstr 0 : { *(.stab.exclstr) }
182         .stab.index 0 : { *(.stab.index) }
183         .stab.indexstr 0 : { *(.stab.indexstr) }
184         .comment 0 : { *(.comment) }
185         /* DWARF debug sections.
186            Symbols in the DWARF debugging sections are relative to the beginning
187            of the section so we begin them at 0.  */
188         /* DWARF 1 */
189         .debug          0 : { *(.debug) }
190         .line           0 : { *(.line) }
191         /* GNU DWARF 1 extensions */
192         .debug_srcinfo  0 : { *(.debug_srcinfo) }
193         .debug_sfnames  0 : { *(.debug_sfnames) }
194         /* DWARF 1.1 and DWARF 2 */
195         .debug_aranges  0 : { *(.debug_aranges) }
196         .debug_pubnames 0 : { *(.debug_pubnames) }
197         /* DWARF 2 */
198         .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
199         .debug_abbrev   0 : { *(.debug_abbrev) }
200         .debug_line     0 : { *(.debug_line) }
201         .debug_frame    0 : { *(.debug_frame) }
202         .debug_str      0 : { *(.debug_str) }
203         .debug_loc      0 : { *(.debug_loc) }
204         .debug_macinfo  0 : { *(.debug_macinfo) }
205         /* SGI/MIPS DWARF 2 extensions */
206         .debug_weaknames 0 : { *(.debug_weaknames) }
207         .debug_funcnames 0 : { *(.debug_funcnames) }
208         .debug_typenames 0 : { *(.debug_typenames) }
209         .debug_varnames  0 : { *(.debug_varnames) }
210 }