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