OSDN Git Service

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