OSDN Git Service

When compiled with CVS binutils, busybox fails to execute properly.
[uclinux-h8/elf2flt.git] / elf2flt.ld
1
2 ENTRY (_start)
3
4 MEMORY {
5         flatmem : ORIGIN = 0x0, LENGTH = 0xfffffff
6 }
7
8 SECTIONS {
9
10         .text 0x0 : {
11                 . = . + 4;
12                 . = ALIGN(0x4) ;
13                 _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(__ctbp = .);
36                 *(.call_table_data)
37                 *(.call_table_text)
38
39                 . = ALIGN(0x20) ;
40                 _etext = . ;
41         } > flatmem
42
43         .data : {
44                 . = ALIGN(0x4) ;
45                 _sdata = . ;
46                 __data_start = . ;
47                 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                 _ssrw = . ;                     
66                 *(.sdata) 
67                 *(.sdata.*)
68                 *(.sbss)                        /* Don't move this! */
69                 *(.gnu.linkonce.sb*)
70                 _essrw = . ;
71
72                 _ssrw_size = _essrw - _ssrw;
73                 PROVIDE(_SDA_BASE_ = _ssrw + (_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                 _ssro = . ;
84                 *(.sdata2)
85                 _essro = . ;
86                 _ssro_size = _essro - _ssro;
87                 PROVIDE(_SDA2_BASE_ = _ssro + (_ssro_size / 2));
88
89                 . = ALIGN(4) ;
90                 __CTOR_LIST__ = .;
91                 LONG((__CTOR_END__ - __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                 LONG(0)
110                 __CTOR_END__ = .;
111                 __DTOR_LIST__ = .;
112                 LONG((__DTOR_END__ - __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                 LONG(0)
118                 __DTOR_END__ = .;
119
120                 PROVIDE (__preinit_array_start = .);
121                 KEEP (*(.preinit_array))
122                 PROVIDE (__preinit_array_end = .);
123
124                 PROVIDE (__init_array_start = .);
125                 KEEP (*(SORT(.init_array.*)))
126                 KEEP (*(.init_array))
127                 PROVIDE (__init_array_end = .);
128
129                 PROVIDE (__fini_array_start = .);
130                 KEEP (*(.fini_array))
131                 KEEP (*(SORT(.fini_array.*)))
132                 PROVIDE (__fini_array_end = .);
133
134         } > flatmem
135
136         .eh_frame_hdr : { *(.eh_frame_hdr) } > flatmem
137         .eh_frame : { KEEP(*(.eh_frame)) } > flatmem
138         .gcc_except_table : { KEEP(*(.gcc_except_table)) } >flatmem
139
140         . = ALIGN(0x10) ; 
141         _edata = . ;
142
143         .bss : {
144                 . = ALIGN(0x4) ;
145                 _sbss = ALIGN(0x4) ;
146                 __bss_start = . ;
147                 *(.dynsbss)
148                 *(.sbss)
149                 *(.sbss.*)
150                 *(.scommon)
151                 *(.dynbss)
152                 *(.bss)
153                 *(.bss.*)
154                 *(.bss*)
155                 *(.gnu.linkonce.b*)
156                 *(COMMON)
157                 . = ALIGN(0x10) ;
158                 _ebss = . ;
159                 _end = . ;
160                 end = . ;
161         } > flatmem
162
163         .stack : {
164                 . = ALIGN(0x4);
165                 __stack_start = .;
166         }
167
168         .junk 0 : { *(.rel*) *(.rela*) }
169         /* Stabs debugging sections.    */
170         .stab 0 : { *(.stab) }
171         .stabstr 0 : { *(.stabstr) }
172         .stab.excl 0 : { *(.stab.excl) }
173         .stab.exclstr 0 : { *(.stab.exclstr) }
174         .stab.index 0 : { *(.stab.index) }
175         .stab.indexstr 0 : { *(.stab.indexstr) }
176         .comment 0 : { *(.comment) }
177         .debug_abbrev 0 : { *(.debug_abbrev) }
178         .debug_info 0 : { *(.debug_info) }
179         .debug_line 0 : { *(.debug_line) }
180         .debug_pubnames 0 : { *(.debug_pubnames) }
181         .debug_aranges 0 : { *(.debug_aranges) }
182         .debug_frame    0 : { *(.debug_frame) }
183         .debug_str      0 : { *(.debug_str) }
184 }