loader: better system() path handling
[ginge.git] / loader / script_arm.lds
1 /* Script for -z combreloc: combine and sort reloc sections */
2 OUTPUT_FORMAT("elf32-littlearm")
3 OUTPUT_ARCH(arm)
4 ENTRY(_start)
5 SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib");
6 SECTIONS
7 {
8   mybase = 0x70000000; /* 0x00008000 */
9   /* Read-only sections, merged into text segment: */
10   PROVIDE (__executable_start = mybase);
11   . = mybase + SIZEOF_HEADERS;
12   .interp         : { *(.interp) }
13   .hash           : { *(.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*)
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     }
34   .rela.dyn       :
35     {
36       *(.rela.init)
37       *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
38       *(.rela.fini)
39       *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
40       *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
41       *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
42       *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
43       *(.rela.ctors)
44       *(.rela.dtors)
45       *(.rela.got)
46       *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
47     }
48   .rel.plt        : { *(.rel.plt) }
49   .rela.plt       : { *(.rela.plt) }
50   .init           :
51   {
52     KEEP (*(.init))
53   } =0
54   .plt            : { *(.plt) }
55   .text           :
56   {
57     *(.text .stub .text.* .gnu.linkonce.t.*)
58     KEEP (*(.text.*personality*))
59     /* .gnu.warning sections are handled specially by elf32.em.  */
60     *(.gnu.warning)
61     *(.glue_7t) *(.glue_7)
62   } =0
63   .fini           :
64   {
65     KEEP (*(.fini))
66   } =0
67   PROVIDE (__etext = .);
68   PROVIDE (_etext = .);
69   PROVIDE (etext = .);
70   .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
71   .rodata1        : { *(.rodata1) }
72   .eh_frame_hdr : { *(.eh_frame_hdr) }
73   .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }
74   .gcc_except_table   : ONLY_IF_RO { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) }
75   /* Adjust the address for the data segment.  We want to adjust up to
76      the same address within the page on the next page up.  */
77   . = ALIGN (0x8000) - ((0x8000 - .) & (0x8000 - 1)); . = DATA_SEGMENT_ALIGN (0x8000, 0x1000);
78   /* Exception handling  */
79   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
80   .gcc_except_table   : ONLY_IF_RW { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) }
81   /* Thread Local Storage sections  */
82   .tdata          : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
83   .tbss           : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
84   /* Ensure the __preinit_array_start label is properly aligned.  We
85      could instead move the label definition inside the section, but
86      the linker would then create the section even if it turns out to
87      be empty, which isn't pretty.  */
88   . = ALIGN(32 / 8);
89   PROVIDE (__preinit_array_start = .);
90   .preinit_array     : { KEEP (*(.preinit_array)) }
91   PROVIDE (__preinit_array_end = .);
92   PROVIDE (__init_array_start = .);
93   .init_array     : { KEEP (*(.init_array)) }
94   PROVIDE (__init_array_end = .);
95   PROVIDE (__fini_array_start = .);
96   .fini_array     : { KEEP (*(.fini_array)) }
97   PROVIDE (__fini_array_end = .);
98   .ctors          :
99   {
100     /* gcc uses crtbegin.o to find the start of
101        the constructors, so we make sure it is
102        first.  Because this is a wildcard, it
103        doesn't matter if the user does not
104        actually link against crtbegin.o; the
105        linker won't look for a file to match a
106        wildcard.  The wildcard also means that it
107        doesn't matter which directory crtbegin.o
108        is in.  */
109     KEEP (*crtbegin*.o(.ctors))
110     /* We don't want to include the .ctor section from
111        from the crtend.o file until after the sorted ctors.
112        The .ctor section from the crtend file contains the
113        end of ctors marker and it must be last */
114     KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
115     KEEP (*(SORT(.ctors.*)))
116     KEEP (*(.ctors))
117   }
118   .dtors          :
119   {
120     KEEP (*crtbegin*.o(.dtors))
121     KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
122     KEEP (*(SORT(.dtors.*)))
123     KEEP (*(.dtors))
124   }
125   .jcr            : { KEEP (*(.jcr)) }
126   .data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro*) }
127   .dynamic        : { *(.dynamic) }
128   . = DATA_SEGMENT_RELRO_END (0, .);
129   .got            : { *(.got.plt) *(.got) }
130   .data           :
131   {
132     __data_start = . ;
133     *(.data .data.* .gnu.linkonce.d.*)
134     KEEP (*(.gnu.linkonce.d.*personality*))
135     SORT(CONSTRUCTORS)
136   }
137   .data1          : { *(.data1) }
138   _edata = .;
139   PROVIDE (edata = .);
140   __bss_start = .;
141   __bss_start__ = .;
142   .bss            :
143   {
144    *(.dynbss)
145    *(.bss .bss.* .gnu.linkonce.b.*)
146    *(COMMON)
147    /* Align here to ensure that the .bss section occupies space up to
148       _end.  Align after .bss to ensure correct alignment even if the
149       .bss section disappears because there are no input sections.  */
150    . = ALIGN(32 / 8);
151   }
152   . = ALIGN(32 / 8);
153   _end = .;
154   _bss_end__ = . ; __bss_end__ = . ; __end__ = . ;
155   PROVIDE (end = .);
156   . = DATA_SEGMENT_END (.);
157   /* Stabs debugging sections.  */
158   .stab          0 : { *(.stab) }
159   .stabstr       0 : { *(.stabstr) }
160   .stab.excl     0 : { *(.stab.excl) }
161   .stab.exclstr  0 : { *(.stab.exclstr) }
162   .stab.index    0 : { *(.stab.index) }
163   .stab.indexstr 0 : { *(.stab.indexstr) }
164   .comment       0 : { *(.comment) }
165   /* DWARF debug sections.
166      Symbols in the DWARF debugging sections are relative to the beginning
167      of the section so we begin them at 0.  */
168   /* DWARF 1 */
169   .debug          0 : { *(.debug) }
170   .line           0 : { *(.line) }
171   /* GNU DWARF 1 extensions */
172   .debug_srcinfo  0 : { *(.debug_srcinfo) }
173   .debug_sfnames  0 : { *(.debug_sfnames) }
174   /* DWARF 1.1 and DWARF 2 */
175   .debug_aranges  0 : { *(.debug_aranges) }
176   .debug_pubnames 0 : { *(.debug_pubnames) }
177   /* DWARF 2 */
178   .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
179   .debug_abbrev   0 : { *(.debug_abbrev) }
180   .debug_line     0 : { *(.debug_line) }
181   .debug_frame    0 : { *(.debug_frame) }
182   .debug_str      0 : { *(.debug_str) }
183   .debug_loc      0 : { *(.debug_loc) }
184   .debug_macinfo  0 : { *(.debug_macinfo) }
185   /* SGI/MIPS DWARF 2 extensions */
186   .debug_weaknames 0 : { *(.debug_weaknames) }
187   .debug_funcnames 0 : { *(.debug_funcnames) }
188   .debug_typenames 0 : { *(.debug_typenames) }
189   .debug_varnames  0 : { *(.debug_varnames) }
190   .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
191   /DISCARD/ : { *(.note.GNU-stack) }
192 }
193
194