xref: /freebsd/sys/conf/ldscript.amd64 (revision db33c6f3ae9d1231087710068ee4ea5398aacca7)
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_BY_INIT_PRIORITY(.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 (*(SORT_BY_INIT_PRIORITY(.fini_array.*)))
104    KEEP (*(.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
181  /* Debug */
182  INCLUDE debuginfo.ldscript
183
184  .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
185  /DISCARD/ : { *(.note.GNU-stack) }
186}
187