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