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