barebox_default_env: fix out of tree build
[barebox-mini2440.git] / board / sandbox / barebox.lds.S
blob53e9f6021aef8fbad0d08209e581e7bf970fa8c0
1 #include <asm-generic/barebox.lds.h>
3 OUTPUT_FORMAT(ELF_FORMAT)
4 OUTPUT_ARCH(ELF_ARCH)
5 ENTRY(_start)
7 SECTIONS
9   /* Read-only sections, merged into text segment: */
10   PROVIDE (__executable_start = 0x400000); . = 0x400000 + SIZEOF_HEADERS;
11   .interp         : { *(.interp) }
12   .hash           : { *(.hash) }
13   .gnu.hash       : { *(.gnu.hash) }
14   .dynsym         : { *(.dynsym) }
15   .dynstr         : { *(.dynstr) }
16   .gnu.version    : { *(.gnu.version) }
17   .gnu.version_d  : { *(.gnu.version_d) }
18   .gnu.version_r  : { *(.gnu.version_r) }
19   .rel.dyn        :
20     {
21       *(.rel.init)
22       *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
23       *(.rel.fini)
24       *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
25       *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*)
26       *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
27       *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
28       *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
29       *(.rel.ctors)
30       *(.rel.dtors)
31       *(.rel.got)
32       *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
33       *(.rel.ldata .rel.ldata.* .rel.gnu.linkonce.l.*)
34       *(.rel.lbss .rel.lbss.* .rel.gnu.linkonce.lb.*)
35       *(.rel.lrodata .rel.lrodata.* .rel.gnu.linkonce.lr.*)
36     }
37   .rela.dyn       :
38     {
39       *(.rela.init)
40       *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
41       *(.rela.fini)
42       *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
43       *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
44       *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
45       *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
46       *(.rela.ctors)
47       *(.rela.dtors)
48       *(.rela.got)
49       *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
50       *(.rela.ldata .rela.ldata.* .rela.gnu.linkonce.l.*)
51       *(.rela.lbss .rela.lbss.* .rela.gnu.linkonce.lb.*)
52       *(.rela.lrodata .rela.lrodata.* .rela.gnu.linkonce.lr.*)
53     }
54   .rel.plt        : { *(.rel.plt) }
55   .rela.plt       : { *(.rela.plt) }
56   .init           :
57   {
58     KEEP (*(.init))
59   } =0x90909090
60   .plt            : { *(.plt) }
61   .text           :
62   {
63     *(.text .stub .text.* .gnu.linkonce.t.*)
64     KEEP (*(.text.*personality*))
65     /* .gnu.warning sections are handled specially by elf32.em.  */
66     *(.gnu.warning)
67   } =0x90909090
68   .fini           :
69   {
70     KEEP (*(.fini))
71   } =0x90909090
73   . = ALIGN(64);
74   __barebox_initcalls_start = .;
75   __barebox_initcalls : { INITCALLS }
76   __barebox_initcalls_end = .;
77   . = ALIGN(64);
78   __barebox_cmd_start = .;
79   __barebox_cmd : { BAREBOX_CMDS }
80   __barebox_cmd_end = .;
82   PROVIDE (__etext = .);
83   PROVIDE (_etext = .);
84   PROVIDE (etext = .);
85   .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
86   .rodata1        : { *(.rodata1) }
87   .eh_frame_hdr : { *(.eh_frame_hdr) }
88   .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }
89   .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
90   /* Adjust the address for the data segment.  We want to adjust up to
91      the same address within the page on the next page up.  */
92   . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
93   /* Exception handling  */
94   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
95   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
96   /* Thread Local Storage sections  */
97   .tdata          : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
98   .tbss           : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
99   .preinit_array     :
100   {
101     PROVIDE_HIDDEN (__preinit_array_start = .);
102     KEEP (*(.preinit_array))
103     PROVIDE_HIDDEN (__preinit_array_end = .);
104   }
105   .init_array     :
106   {
107      PROVIDE_HIDDEN (__init_array_start = .);
108      KEEP (*(SORT(.init_array.*)))
109      KEEP (*(.init_array))
110      PROVIDE_HIDDEN (__init_array_end = .);
111   }
112   .fini_array     :
113   {
114     PROVIDE_HIDDEN (__fini_array_start = .);
115     KEEP (*(.fini_array))
116     KEEP (*(SORT(.fini_array.*)))
117     PROVIDE_HIDDEN (__fini_array_end = .);
118   }
119   .ctors          :
120   {
121     /* gcc uses crtbegin.o to find the start of
122        the constructors, so we make sure it is
123        first.  Because this is a wildcard, it
124        doesn't matter if the user does not
125        actually link against crtbegin.o; the
126        linker won't look for a file to match a
127        wildcard.  The wildcard also means that it
128        doesn't matter which directory crtbegin.o
129        is in.  */
130     KEEP (*crtbegin.o(.ctors))
131     KEEP (*crtbegin?.o(.ctors))
132     /* We don't want to include the .ctor section from
133        the crtend.o file until after the sorted ctors.
134        The .ctor section from the crtend file contains the
135        end of ctors marker and it must be last */
136     KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
137     KEEP (*(SORT(.ctors.*)))
138     KEEP (*(.ctors))
139   }
140   .dtors          :
141   {
142     KEEP (*crtbegin.o(.dtors))
143     KEEP (*crtbegin?.o(.dtors))
144     KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
145     KEEP (*(SORT(.dtors.*)))
146     KEEP (*(.dtors))
147   }
148   .jcr            : { KEEP (*(.jcr)) }
149   .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
150   .dynamic        : { *(.dynamic) }
151   .got            : { *(.got) }
152   . = DATA_SEGMENT_RELRO_END (24, .);
153   .got.plt        : { *(.got.plt) }
154   .data           :
155   {
156     *(.data .data.* .gnu.linkonce.d.*)
157     KEEP (*(.gnu.linkonce.d.*personality*))
158     SORT(CONSTRUCTORS)
159   }
160   .data1          : { *(.data1) }
161   _edata = .; PROVIDE (edata = .);
162   __bss_start = .;
163   .bss            :
164   {
165    *(.dynbss)
166    *(.bss .bss.* .gnu.linkonce.b.*)
167    *(COMMON)
168    /* Align here to ensure that the .bss section occupies space up to
169       _end.  Align after .bss to ensure correct alignment even if the
170       .bss section disappears because there are no input sections.
171       FIXME: Why do we need it? When there is no .bss section, we don't
172       pad the .data section.  */
173    . = ALIGN(. != 0 ? 64 / 8 : 1);
174   }
175   .lbss   :
176   {
177     *(.dynlbss)
178     *(.lbss .lbss.* .gnu.linkonce.lb.*)
179     *(LARGE_COMMON)
180   }
181   . = ALIGN(64 / 8);
182   .lrodata   ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)) :
183   {
184     *(.lrodata .lrodata.* .gnu.linkonce.lr.*)
185   }
186   .ldata   ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)) :
187   {
188     *(.ldata .ldata.* .gnu.linkonce.l.*)
189     . = ALIGN(. != 0 ? 64 / 8 : 1);
190   }
191   . = ALIGN(64 / 8);
192   _end = .; PROVIDE (end = .);
193   . = DATA_SEGMENT_END (.);
194   /* Stabs debugging sections.  */
195   .stab          0 : { *(.stab) }
196   .stabstr       0 : { *(.stabstr) }
197   .stab.excl     0 : { *(.stab.excl) }
198   .stab.exclstr  0 : { *(.stab.exclstr) }
199   .stab.index    0 : { *(.stab.index) }
200   .stab.indexstr 0 : { *(.stab.indexstr) }
201   .comment       0 : { *(.comment) }
202   /* DWARF debug sections.
203      Symbols in the DWARF debugging sections are relative to the beginning
204      of the section so we begin them at 0.  */
205   /* DWARF 1 */
206   .debug          0 : { *(.debug) }
207   .line           0 : { *(.line) }
208   /* GNU DWARF 1 extensions */
209   .debug_srcinfo  0 : { *(.debug_srcinfo) }
210   .debug_sfnames  0 : { *(.debug_sfnames) }
211   /* DWARF 1.1 and DWARF 2 */
212   .debug_aranges  0 : { *(.debug_aranges) }
213   .debug_pubnames 0 : { *(.debug_pubnames) }
214   /* DWARF 2 */
215   .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
216   .debug_abbrev   0 : { *(.debug_abbrev) }
217   .debug_line     0 : { *(.debug_line) }
218   .debug_frame    0 : { *(.debug_frame) }
219   .debug_str      0 : { *(.debug_str) }
220   .debug_loc      0 : { *(.debug_loc) }
221   .debug_macinfo  0 : { *(.debug_macinfo) }
222   /* SGI/MIPS DWARF 2 extensions */
223   .debug_weaknames 0 : { *(.debug_weaknames) }
224   .debug_funcnames 0 : { *(.debug_funcnames) }
225   .debug_typenames 0 : { *(.debug_typenames) }
226   .debug_varnames  0 : { *(.debug_varnames) }
227   /DISCARD/ : { *(.note.GNU-stack) }