xref: /freebsd/sys/conf/ldscript.i386 (revision 911f0260390e18cf85f3dbf2c719b593efdc1e3c)
1/* $FreeBSD$ */
2OUTPUT_FORMAT("elf32-i386-freebsd", "elf32-i386-freebsd", "elf32-i386-freebsd")
3OUTPUT_ARCH(i386)
4ENTRY(btext)
5SEARCH_DIR(/usr/lib);
6SECTIONS
7{
8  /* Read-only sections, merged into text segment: */
9  . = kernbase + SIZEOF_HEADERS;
10  .interp         : { *(.interp) }
11  .hash           : { *(.hash) }
12  .gnu.hash       : { *(.gnu.hash) }
13  .dynsym         : { *(.dynsym) }
14  .dynstr         : { *(.dynstr) }
15  .gnu.version    : { *(.gnu.version) }
16  .gnu.version_d  : { *(.gnu.version_d) }
17  .gnu.version_r  : { *(.gnu.version_r) }
18  .rel.init       : { *(.rel.init) }
19  .rela.init      : { *(.rela.init) }
20  .rel.text       : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
21  .rela.text      : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
22  .rel.fini       : { *(.rel.fini) }
23  .rela.fini      : { *(.rela.fini) }
24  .rel.rodata     : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
25  .rela.rodata    : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
26  .rel.data.rel.ro   : { *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) }
27  .rela.data.rel.ro   : { *(.rela.data.rel.ro* .rela.gnu.linkonce.d.rel.ro.*) }
28  .rel.data       : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
29  .rela.data      : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
30  .rel.tdata	  : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
31  .rela.tdata	  : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
32  .rel.tbss	  : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
33  .rela.tbss	  : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
34  .rel.ctors      : { *(.rel.ctors) }
35  .rela.ctors     : { *(.rela.ctors) }
36  .rel.dtors      : { *(.rel.dtors) }
37  .rela.dtors     : { *(.rela.dtors) }
38  .rel.got        : { *(.rel.got) }
39  .rela.got       : { *(.rela.got) }
40  .rel.bss        : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
41  .rela.bss       : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
42  .rel.plt        : { *(.rel.plt) }
43  .rela.plt       : { *(.rela.plt) }
44  .init           :
45  {
46    KEEP (*(.init))
47  } =0xCCCCCCCC
48  .plt            : { *(.plt) }
49  .text           :
50  {
51    *(.text .stub .text.* .gnu.linkonce.t.*)
52    KEEP (*(.text.*personality*))
53    /* .gnu.warning sections are handled specially by elf32.em.  */
54    *(.gnu.warning)
55  } =0xCCCCCCCC
56  .fini           :
57  {
58    KEEP (*(.fini))
59  } =0xCCCCCCCC
60  PROVIDE (__etext = .);
61  PROVIDE (_etext = .);
62  PROVIDE (etext = .);
63  .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
64  .rodata1        : { *(.rodata1) }
65  .note.gnu.build-id : {
66    PROVIDE (__build_id_start = .);
67    *(.note.gnu.build-id)
68    PROVIDE (__build_id_end = .);
69  }
70  .eh_frame_hdr : { *(.eh_frame_hdr) }
71  .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }
72  .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
73  /* Adjust the address for the data segment.  We want to adjust up to
74     the same address within the page on the next page up.  */
75  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
76  /* Exception handling  */
77  .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
78  .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
79  /* Thread Local Storage sections  */
80  .tdata	  : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
81  .tbss		  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
82  .preinit_array     :
83  {
84    PROVIDE_HIDDEN (__preinit_array_start = .);
85    KEEP (*(.preinit_array))
86    PROVIDE_HIDDEN (__preinit_array_end = .);
87  }
88  .init_array     :
89  {
90     PROVIDE_HIDDEN (__init_array_start = .);
91     KEEP (*(SORT(.init_array.*)))
92     KEEP (*(.init_array))
93     PROVIDE_HIDDEN (__init_array_end = .);
94  }
95  .fini_array     :
96  {
97    PROVIDE_HIDDEN (__fini_array_start = .);
98    KEEP (*(.fini_array))
99    KEEP (*(SORT(.fini_array.*)))
100    PROVIDE_HIDDEN (__fini_array_end = .);
101  }
102  _start_ctors = .;
103  PROVIDE (start_ctors = .);
104  .ctors          :
105  {
106    /* gcc uses crtbegin.o to find the start of
107       the constructors, so we make sure it is
108       first.  Because this is a wildcard, it
109       doesn't matter if the user does not
110       actually link against crtbegin.o; the
111       linker won't look for a file to match a
112       wildcard.  The wildcard also means that it
113       doesn't matter which directory crtbegin.o
114       is in.  */
115    KEEP (*crtbegin.o(.ctors))
116    KEEP (*crtbegin?.o(.ctors))
117    /* We don't want to include the .ctor section from
118       the crtend.o file until after the sorted ctors.
119       The .ctor section from the crtend file contains the
120       end of ctors marker and it must be last */
121    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
122    KEEP (*(SORT(.ctors.*)))
123    KEEP (*(.ctors))
124  }
125  _stop_ctors = .;
126  PROVIDE (stop_ctors = .);
127  .dtors          :
128  {
129    KEEP (*crtbegin.o(.dtors))
130    KEEP (*crtbegin?.o(.dtors))
131    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
132    KEEP (*(SORT(.dtors.*)))
133    KEEP (*(.dtors))
134  }
135  .jcr            : { KEEP (*(.jcr)) }
136  .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
137  .dynamic        : { *(.dynamic) }
138  .got            : { *(.got) }
139  . = DATA_SEGMENT_RELRO_END (12, .);
140  .got.plt        : { *(.got.plt) }
141  .data           :
142  {
143    *(.data .data.* .gnu.linkonce.d.*)
144    KEEP (*(.gnu.linkonce.d.*personality*))
145  }
146  .data1          : { *(.data1) }
147  _edata = .; PROVIDE (edata = .);
148  .bss            :
149  {
150   __bss_start = .;
151   *(.dynbss)
152   *(.bss .bss.* .gnu.linkonce.b.*)
153   *(COMMON)
154   /* Align here to ensure that the .bss section occupies space up to
155      _end.  Align after .bss to ensure correct alignment even if the
156      .bss section disappears because there are no input sections.
157      FIXME: Why do we need it? When there is no .bss section, we don't
158      pad the .data section.  */
159   . = ALIGN(. != 0 ? 32 / 8 : 1);
160   __bss_end = .;
161  }
162  . = ALIGN(32 / 8);
163  . = ALIGN(32 / 8);
164  _end = .; PROVIDE (end = .);
165  . = DATA_SEGMENT_END (.);
166  /* Stabs debugging sections.  */
167  .stab          0 : { *(.stab) }
168  .stabstr       0 : { *(.stabstr) }
169  .stab.excl     0 : { *(.stab.excl) }
170  .stab.exclstr  0 : { *(.stab.exclstr) }
171  .stab.index    0 : { *(.stab.index) }
172  .stab.indexstr 0 : { *(.stab.indexstr) }
173  .comment       0 : { *(.comment) }
174  /* DWARF debug sections.
175     Symbols in the DWARF debugging sections are relative to the beginning
176     of the section so we begin them at 0.  */
177  /* DWARF 1 */
178  .debug          0 : { *(.debug) }
179  .line           0 : { *(.line) }
180  /* GNU DWARF 1 extensions */
181  .debug_srcinfo  0 : { *(.debug_srcinfo) }
182  .debug_sfnames  0 : { *(.debug_sfnames) }
183  /* DWARF 1.1 and DWARF 2 */
184  .debug_aranges  0 : { *(.debug_aranges) }
185  .debug_pubnames 0 : { *(.debug_pubnames) }
186  /* DWARF 2 */
187  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
188  .debug_abbrev   0 : { *(.debug_abbrev) }
189  .debug_line     0 : { *(.debug_line) }
190  .debug_frame    0 : { *(.debug_frame) }
191  .debug_str      0 : { *(.debug_str) }
192  .debug_loc      0 : { *(.debug_loc) }
193  .debug_macinfo  0 : { *(.debug_macinfo) }
194  /* SGI/MIPS DWARF 2 extensions */
195  .debug_weaknames 0 : { *(.debug_weaknames) }
196  .debug_funcnames 0 : { *(.debug_funcnames) }
197  .debug_typenames 0 : { *(.debug_typenames) }
198  .debug_varnames  0 : { *(.debug_varnames) }
199  /* DWARF 3 */
200  .debug_pubtypes 0 : { *(.debug_pubtypes) }
201  .debug_ranges   0 : { *(.debug_ranges) }
202  .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
203  /DISCARD/ : { *(.note.GNU-stack) }
204}
205