1 /* Script for -shared */
2 /* Copyright (C) 2014-2021 Free Software Foundation, Inc.
3    Copying and distribution of this script, with or without modification,
4    are permitted in any medium without royalty provided the copyright
5    notice and this notice are preserved.  */
6 OUTPUT_FORMAT("elf32-bigarm", "elf32-bigarm",
7 	      "elf32-littlearm")
8 OUTPUT_ARCH(arm)
9 ENTRY(_start)
10 SEARCH_DIR("=/aarch64-none-linux-gnu/lib");
11 SECTIONS
12 {
13   /* Read-only sections, merged into text segment: */
14   . = SEGMENT_START("text-segment", 0) + SIZEOF_HEADERS;
15   .note.gnu.build-id  : { *(.note.gnu.build-id) }
16   .hash           : { *(.hash) }
17   .gnu.hash       : { *(.gnu.hash) }
18   .dynsym         : { *(.dynsym) }
19   .dynstr         : { *(.dynstr) }
20   .gnu.version    : { *(.gnu.version) }
21   .gnu.version_d  : { *(.gnu.version_d) }
22   .gnu.version_r  : { *(.gnu.version_r) }
23   .rel.init       : { *(.rel.init) }
24   .rela.init      : { *(.rela.init) }
25   .rel.text       : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
26   .rela.text      : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
27   .rel.fini       : { *(.rel.fini) }
28   .rela.fini      : { *(.rela.fini) }
29   .rel.rodata     : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
30   .rela.rodata    : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
31   .rel.data.rel.ro   : { *(.rel.data.rel.ro .rel.data.rel.ro.* .rel.gnu.linkonce.d.rel.ro.*) }
32   .rela.data.rel.ro   : { *(.rela.data.rel.ro .rela.data.rel.ro.* .rela.gnu.linkonce.d.rel.ro.*) }
33   .rel.data       : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
34   .rela.data      : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
35   .rel.tdata	  : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
36   .rela.tdata	  : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
37   .rel.tbss	  : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
38   .rela.tbss	  : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
39   .rel.ctors      : { *(.rel.ctors) }
40   .rela.ctors     : { *(.rela.ctors) }
41   .rel.dtors      : { *(.rel.dtors) }
42   .rela.dtors     : { *(.rela.dtors) }
43   .rel.got        : { *(.rel.got) }
44   .rela.got       : { *(.rela.got) }
45   .rel.bss        : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
46   .rela.bss       : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
47   .rel.iplt       :
48     {
49       *(.rel.iplt)
50     }
51   .rela.iplt      :
52     {
53       *(.rela.iplt)
54     }
55   .rel.plt        :
56     {
57       *(.rel.plt)
58     }
59   .rela.plt       :
60     {
61       *(.rela.plt)
62     }
63   .init           :
64   {
65     KEEP (*(SORT_NONE(.init)))
66   }
67   .plt            : { *(.plt) }
68   .iplt           : { *(.iplt) }
69   .text           :
70   {
71     *(.text.unlikely .text.*_unlikely .text.unlikely.*)
72     *(.text.exit .text.exit.*)
73     *(.text.startup .text.startup.*)
74     *(.text.hot .text.hot.*)
75     *(SORT(.text.sorted.*))
76     *(.text .stub .text.* .gnu.linkonce.t.*)
77     /* .gnu.warning sections are handled specially by elf.em.  */
78     *(.gnu.warning)
79     *(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx)
80   }
81   .fini           :
82   {
83     KEEP (*(SORT_NONE(.fini)))
84   }
85   PROVIDE (__etext = .);
86   PROVIDE (_etext = .);
87   PROVIDE (etext = .);
88   .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
89   .rodata1        : { *(.rodata1) }
90   .ARM.extab   : { *(.ARM.extab* .gnu.linkonce.armextab.*) }
91   .ARM.exidx   :
92     {
93       PROVIDE_HIDDEN (__exidx_start = .);
94       *(.ARM.exidx* .gnu.linkonce.armexidx.*)
95       PROVIDE_HIDDEN (__exidx_end = .);
96     }
97   .eh_frame_hdr   : { *(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*) }
98   .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) *(.eh_frame.*) }
99   .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
100   .gnu_extab   : ONLY_IF_RO { *(.gnu_extab*) }
101   /* These sections are generated by the Sun/Oracle C++ compiler.  */
102   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges*) }
103   /* Adjust the address for the data segment.  We want to adjust up to
104      the same address within the page on the next page up.  */
105   . = ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1));
106   /* Exception handling  */
107   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) *(.eh_frame.*) }
108   .gnu_extab      : ONLY_IF_RW { *(.gnu_extab) }
109   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
110   .exception_ranges   : ONLY_IF_RW { *(.exception_ranges*) }
111   /* Thread Local Storage sections  */
112   .tdata	  :
113    {
114      *(.tdata .tdata.* .gnu.linkonce.td.*)
115    }
116   .tbss		  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
117   .preinit_array    :
118   {
119     KEEP (*(.preinit_array))
120   }
121   .init_array    :
122   {
123     KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
124     KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))
125   }
126   .fini_array    :
127   {
128     KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
129     KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))
130   }
131   .ctors          :
132   {
133     /* gcc uses crtbegin.o to find the start of
134        the constructors, so we make sure it is
135        first.  Because this is a wildcard, it
136        doesn't matter if the user does not
137        actually link against crtbegin.o; the
138        linker won't look for a file to match a
139        wildcard.  The wildcard also means that it
140        doesn't matter which directory crtbegin.o
141        is in.  */
142     KEEP (*crtbegin.o(.ctors))
143     KEEP (*crtbegin?.o(.ctors))
144     /* We don't want to include the .ctor section from
145        the crtend.o file until after the sorted ctors.
146        The .ctor section from the crtend file contains the
147        end of ctors marker and it must be last */
148     KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
149     KEEP (*(SORT(.ctors.*)))
150     KEEP (*(.ctors))
151   }
152   .dtors          :
153   {
154     KEEP (*crtbegin.o(.dtors))
155     KEEP (*crtbegin?.o(.dtors))
156     KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
157     KEEP (*(SORT(.dtors.*)))
158     KEEP (*(.dtors))
159   }
160   .jcr            : { KEEP (*(.jcr)) }
161   .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }
162   .dynamic        : { *(.dynamic) }
163   .got            : { *(.got.plt) *(.igot.plt) *(.got) *(.igot) }
164   .data           :
165   {
166     PROVIDE (__data_start = .);
167     *(.data .data.* .gnu.linkonce.d.*)
168     SORT(CONSTRUCTORS)
169   }
170   .data1          : { *(.data1) }
171   PROVIDE (_edata = .); PROVIDE (edata = .);
172   /* This section contains data that is initialized during load,
173      but not during the application's initialization sequence.  */
174   .persistent :
175   {
176     . = ALIGN(32 / 8);
177     PROVIDE (__persistent_start = .);
178     *(.persistent .persistent.* .gnu.linkonce.p.*)
179     . = ALIGN(32 / 8);
180     PROVIDE (__persistent_end = .);
181   }
182   . = .;
183   PROVIDE (__bss_start = .);
184   PROVIDE (__bss_start__ = .);
185   .bss            :
186   {
187    *(.dynbss)
188    *(.bss .bss.* .gnu.linkonce.b.*)
189    *(COMMON)
190    /* Align here to ensure that the .bss section occupies space up to
191       _end.  Align after .bss to ensure correct alignment even if the
192       .bss section disappears because there are no input sections.
193       FIXME: Why do we need it? When there is no .bss section, we do not
194       pad the .data section.  */
195    . = ALIGN(. != 0 ? 32 / 8 : 1);
196   }
197   PROVIDE (_bss_end__ = .); PROVIDE (__bss_end__ = .);
198   /* This section contains data that is not initialized during load,
199      or during the application's initialization sequence.  */
noinit(NOLOAD)200   .noinit (NOLOAD) :
201   {
202     . = ALIGN(32 / 8);
203     PROVIDE (__noinit_start = .);
204     *(.noinit .noinit.* .gnu.linkonce.n.*)
205     . = ALIGN(32 / 8);
206     PROVIDE (__noinit_end = .);
207   }
208   . = ALIGN(32 / 8);
209   . = SEGMENT_START("ldata-segment", .);
210   . = ALIGN(32 / 8);
211   PROVIDE (__end__ = .);
212   PROVIDE (_end = .); PROVIDE (end = .);
213   .stack         0x80000 :
214   {
215     _stack = .;
216     *(.stack)
217   }
218   /* Stabs debugging sections.  */
219   .stab          0 : { *(.stab) }
220   .stabstr       0 : { *(.stabstr) }
221   .stab.excl     0 : { *(.stab.excl) }
222   .stab.exclstr  0 : { *(.stab.exclstr) }
223   .stab.index    0 : { *(.stab.index) }
224   .stab.indexstr 0 : { *(.stab.indexstr) }
225   .comment       0 : { *(.comment) }
226   .gnu.build.attributes : { *(.gnu.build.attributes .gnu.build.attributes.*) }
227   /* DWARF debug sections.
228      Symbols in the DWARF debugging sections are relative to the beginning
229      of the section so we begin them at 0.  */
230   /* DWARF 1.  */
231   .debug          0 : { *(.debug) }
232   .line           0 : { *(.line) }
233   /* GNU DWARF 1 extensions.  */
234   .debug_srcinfo  0 : { *(.debug_srcinfo) }
235   .debug_sfnames  0 : { *(.debug_sfnames) }
236   /* DWARF 1.1 and DWARF 2.  */
237   .debug_aranges  0 : { *(.debug_aranges) }
238   .debug_pubnames 0 : { *(.debug_pubnames) }
239   /* DWARF 2.  */
240   .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
241   .debug_abbrev   0 : { *(.debug_abbrev) }
242   .debug_line     0 : { *(.debug_line .debug_line.* .debug_line_end) }
243   .debug_frame    0 : { *(.debug_frame) }
244   .debug_str      0 : { *(.debug_str) }
245   .debug_loc      0 : { *(.debug_loc) }
246   .debug_macinfo  0 : { *(.debug_macinfo) }
247   /* SGI/MIPS DWARF 2 extensions.  */
248   .debug_weaknames 0 : { *(.debug_weaknames) }
249   .debug_funcnames 0 : { *(.debug_funcnames) }
250   .debug_typenames 0 : { *(.debug_typenames) }
251   .debug_varnames  0 : { *(.debug_varnames) }
252   /* DWARF 3.  */
253   .debug_pubtypes 0 : { *(.debug_pubtypes) }
254   .debug_ranges   0 : { *(.debug_ranges) }
255   /* DWARF 5.  */
256   .debug_addr     0 : { *(.debug_addr) }
257   .debug_line_str 0 : { *(.debug_line_str) }
258   .debug_loclists 0 : { *(.debug_loclists) }
259   .debug_macro    0 : { *(.debug_macro) }
260   .debug_names    0 : { *(.debug_names) }
261   .debug_rnglists 0 : { *(.debug_rnglists) }
262   .debug_str_offsets 0 : { *(.debug_str_offsets) }
263   .debug_sup      0 : { *(.debug_sup) }
264   .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP (*(.gnu.attributes)) }
265   .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
266   /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
267 }
268