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