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