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