xref: /freebsd/sys/conf/ldscript.amd64 (revision 8ba66bb849129624b0ce9c2a510c20b84778d1d9)
1d0e12656SPeter Wemm/* $FreeBSD$ */
2491fb274SDimitry AndricOUTPUT_FORMAT("elf64-x86-64-freebsd", "elf64-x86-64-freebsd", "elf64-x86-64-freebsd")
3b05deb9bSPeter WemmOUTPUT_ARCH(i386:x86-64)
46b7a14ceSPeter WemmENTRY(btext)
5b05deb9bSPeter WemmSEARCH_DIR("/usr/lib");
66b7a14ceSPeter WemmSECTIONS
76b7a14ceSPeter Wemm{
86b7a14ceSPeter Wemm  /* Read-only sections, merged into text segment: */
9714d4612SDimitry Andric  . = kernbase + CONSTANT (MAXPAGESIZE) + SIZEOF_HEADERS;
106b7a14ceSPeter Wemm  .interp         : { *(.interp) }
116b7a14ceSPeter Wemm  .hash           : { *(.hash) }
12*8ba66bb8SDimitry Andric  .gnu.hash       : { *(.gnu.hash) }
136b7a14ceSPeter Wemm  .dynsym         : { *(.dynsym) }
146b7a14ceSPeter Wemm  .dynstr         : { *(.dynstr) }
156b7a14ceSPeter Wemm  .gnu.version    : { *(.gnu.version) }
166b7a14ceSPeter Wemm  .gnu.version_d  : { *(.gnu.version_d) }
176b7a14ceSPeter Wemm  .gnu.version_r  : { *(.gnu.version_r) }
18b05deb9bSPeter Wemm  .rel.init       : { *(.rel.init) }
19b05deb9bSPeter Wemm  .rela.init      : { *(.rela.init) }
20b05deb9bSPeter Wemm  .rel.text       : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
21b05deb9bSPeter Wemm  .rela.text      : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
22b05deb9bSPeter Wemm  .rel.fini       : { *(.rel.fini) }
23b05deb9bSPeter Wemm  .rela.fini      : { *(.rela.fini) }
24b05deb9bSPeter Wemm  .rel.rodata     : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
25b05deb9bSPeter Wemm  .rela.rodata    : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
26*8ba66bb8SDimitry Andric  .rel.data.rel.ro   : { *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) }
27*8ba66bb8SDimitry Andric  .rela.data.rel.ro   : { *(.rela.data.rel.ro* .rela.gnu.linkonce.d.rel.ro.*) }
28b05deb9bSPeter Wemm  .rel.data       : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
29b05deb9bSPeter Wemm  .rela.data      : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
30b05deb9bSPeter Wemm  .rel.tdata	  : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
31b05deb9bSPeter Wemm  .rela.tdata	  : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
32b05deb9bSPeter Wemm  .rel.tbss	  : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
33b05deb9bSPeter Wemm  .rela.tbss	  : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
346b7a14ceSPeter Wemm  .rel.ctors      : { *(.rel.ctors) }
356b7a14ceSPeter Wemm  .rela.ctors     : { *(.rela.ctors) }
366b7a14ceSPeter Wemm  .rel.dtors      : { *(.rel.dtors) }
376b7a14ceSPeter Wemm  .rela.dtors     : { *(.rela.dtors) }
38b05deb9bSPeter Wemm  .rel.got        : { *(.rel.got) }
39b05deb9bSPeter Wemm  .rela.got       : { *(.rela.got) }
40b05deb9bSPeter Wemm  .rel.bss        : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
41b05deb9bSPeter Wemm  .rela.bss       : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
42*8ba66bb8SDimitry Andric  .rel.ldata      : { *(.rel.ldata .rel.ldata.* .rel.gnu.linkonce.l.*) }
43*8ba66bb8SDimitry Andric  .rela.ldata     : { *(.rela.ldata .rela.ldata.* .rela.gnu.linkonce.l.*) }
44*8ba66bb8SDimitry Andric  .rel.lbss       : { *(.rel.lbss .rel.lbss.* .rel.gnu.linkonce.lb.*) }
45*8ba66bb8SDimitry Andric  .rela.lbss      : { *(.rela.lbss .rela.lbss.* .rela.gnu.linkonce.lb.*) }
46*8ba66bb8SDimitry Andric  .rel.lrodata    : { *(.rel.lrodata .rel.lrodata.* .rel.gnu.linkonce.lr.*) }
47*8ba66bb8SDimitry Andric  .rela.lrodata   : { *(.rela.lrodata .rela.lrodata.* .rela.gnu.linkonce.lr.*) }
486b7a14ceSPeter Wemm  .rel.plt        : { *(.rel.plt) }
496b7a14ceSPeter Wemm  .rela.plt       : { *(.rela.plt) }
50b05deb9bSPeter Wemm  .init           :
51b05deb9bSPeter Wemm  {
52b05deb9bSPeter Wemm    KEEP (*(.init))
53b05deb9bSPeter Wemm  } =0x90909090
546b7a14ceSPeter Wemm  .plt            : { *(.plt) }
556b7a14ceSPeter Wemm  .text           :
566b7a14ceSPeter Wemm  {
57b05deb9bSPeter Wemm    *(.text .stub .text.* .gnu.linkonce.t.*)
58*8ba66bb8SDimitry Andric    KEEP (*(.text.*personality*))
596b7a14ceSPeter Wemm    /* .gnu.warning sections are handled specially by elf32.em.  */
606b7a14ceSPeter Wemm    *(.gnu.warning)
61b05deb9bSPeter Wemm  } =0x90909090
62b05deb9bSPeter Wemm  .fini           :
63b05deb9bSPeter Wemm  {
64b05deb9bSPeter Wemm    KEEP (*(.fini))
65b05deb9bSPeter Wemm  } =0x90909090
66b05deb9bSPeter Wemm  PROVIDE (__etext = .);
67b05deb9bSPeter Wemm  PROVIDE (_etext = .);
686b7a14ceSPeter Wemm  PROVIDE (etext = .);
69b05deb9bSPeter Wemm  .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
706b7a14ceSPeter Wemm  .rodata1        : { *(.rodata1) }
71b05deb9bSPeter Wemm  .eh_frame_hdr : { *(.eh_frame_hdr) }
72*8ba66bb8SDimitry Andric  .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }
73*8ba66bb8SDimitry Andric  .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
746b7a14ceSPeter Wemm  /* Adjust the address for the data segment.  We want to adjust up to
756b7a14ceSPeter Wemm     the same address within the page on the next page up.  */
76*8ba66bb8SDimitry Andric  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
77*8ba66bb8SDimitry Andric  /* Exception handling  */
78*8ba66bb8SDimitry Andric  .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
79*8ba66bb8SDimitry Andric  .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
80*8ba66bb8SDimitry Andric  /* Thread Local Storage sections  */
81b05deb9bSPeter Wemm  .tdata	  : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
82b05deb9bSPeter Wemm  .tbss		  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
83*8ba66bb8SDimitry Andric  .preinit_array     :
84*8ba66bb8SDimitry Andric  {
85*8ba66bb8SDimitry Andric    PROVIDE_HIDDEN (__preinit_array_start = .);
86*8ba66bb8SDimitry Andric    KEEP (*(.preinit_array))
87*8ba66bb8SDimitry Andric    PROVIDE_HIDDEN (__preinit_array_end = .);
88*8ba66bb8SDimitry Andric  }
89*8ba66bb8SDimitry Andric  .init_array     :
90*8ba66bb8SDimitry Andric  {
91*8ba66bb8SDimitry Andric     PROVIDE_HIDDEN (__init_array_start = .);
92*8ba66bb8SDimitry Andric     KEEP (*(SORT(.init_array.*)))
93*8ba66bb8SDimitry Andric     KEEP (*(.init_array))
94*8ba66bb8SDimitry Andric     PROVIDE_HIDDEN (__init_array_end = .);
95*8ba66bb8SDimitry Andric  }
96*8ba66bb8SDimitry Andric  .fini_array     :
97*8ba66bb8SDimitry Andric  {
98*8ba66bb8SDimitry Andric    PROVIDE_HIDDEN (__fini_array_start = .);
99*8ba66bb8SDimitry Andric    KEEP (*(.fini_array))
100*8ba66bb8SDimitry Andric    KEEP (*(SORT(.fini_array.*)))
101*8ba66bb8SDimitry Andric    PROVIDE_HIDDEN (__fini_array_end = .);
102*8ba66bb8SDimitry Andric  }
103907cb02fSTim J. Robbins  _start_ctors = .;
104907cb02fSTim J. Robbins  PROVIDE (start_ctors = .);
1056b7a14ceSPeter Wemm  .ctors          :
1066b7a14ceSPeter Wemm  {
107b05deb9bSPeter Wemm    /* gcc uses crtbegin.o to find the start of
108b05deb9bSPeter Wemm       the constructors, so we make sure it is
109b05deb9bSPeter Wemm       first.  Because this is a wildcard, it
110b05deb9bSPeter Wemm       doesn't matter if the user does not
111b05deb9bSPeter Wemm       actually link against crtbegin.o; the
112b05deb9bSPeter Wemm       linker won't look for a file to match a
113b05deb9bSPeter Wemm       wildcard.  The wildcard also means that it
114b05deb9bSPeter Wemm       doesn't matter which directory crtbegin.o
115b05deb9bSPeter Wemm       is in.  */
116b05deb9bSPeter Wemm    KEEP (*crtbegin.o(.ctors))
117*8ba66bb8SDimitry Andric    KEEP (*crtbegin?.o(.ctors))
118b05deb9bSPeter Wemm    /* We don't want to include the .ctor section from
119*8ba66bb8SDimitry Andric       the crtend.o file until after the sorted ctors.
120b05deb9bSPeter Wemm       The .ctor section from the crtend file contains the
121b05deb9bSPeter Wemm       end of ctors marker and it must be last */
122*8ba66bb8SDimitry Andric    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
123b05deb9bSPeter Wemm    KEEP (*(SORT(.ctors.*)))
124b05deb9bSPeter Wemm    KEEP (*(.ctors))
1256b7a14ceSPeter Wemm  }
126907cb02fSTim J. Robbins  _stop_ctors = .;
127907cb02fSTim J. Robbins  PROVIDE (stop_ctors = .);
1286b7a14ceSPeter Wemm  .dtors          :
1296b7a14ceSPeter Wemm  {
130b05deb9bSPeter Wemm    KEEP (*crtbegin.o(.dtors))
131*8ba66bb8SDimitry Andric    KEEP (*crtbegin?.o(.dtors))
132*8ba66bb8SDimitry Andric    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
133b05deb9bSPeter Wemm    KEEP (*(SORT(.dtors.*)))
134b05deb9bSPeter Wemm    KEEP (*(.dtors))
1356b7a14ceSPeter Wemm  }
136b05deb9bSPeter Wemm  .jcr            : { KEEP (*(.jcr)) }
137*8ba66bb8SDimitry Andric  .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
138*8ba66bb8SDimitry Andric  .dynamic        : { *(.dynamic) }
139*8ba66bb8SDimitry Andric  .got            : { *(.got) }
140*8ba66bb8SDimitry Andric  . = DATA_SEGMENT_RELRO_END (24, .);
141*8ba66bb8SDimitry Andric  .got.plt        : { *(.got.plt) }
142*8ba66bb8SDimitry Andric  .data           :
143*8ba66bb8SDimitry Andric  {
144*8ba66bb8SDimitry Andric    *(.data .data.* .gnu.linkonce.d.*)
145*8ba66bb8SDimitry Andric    KEEP (*(.gnu.linkonce.d.*personality*))
146*8ba66bb8SDimitry Andric    SORT(CONSTRUCTORS)
147*8ba66bb8SDimitry Andric  }
148*8ba66bb8SDimitry Andric  .data1          : { *(.data1) }
149*8ba66bb8SDimitry Andric  _edata = .; PROVIDE (edata = .);
1506b7a14ceSPeter Wemm  __bss_start = .;
1516b7a14ceSPeter Wemm  .bss            :
1526b7a14ceSPeter Wemm  {
1536b7a14ceSPeter Wemm   *(.dynbss)
154b05deb9bSPeter Wemm   *(.bss .bss.* .gnu.linkonce.b.*)
1556b7a14ceSPeter Wemm   *(COMMON)
156b05deb9bSPeter Wemm   /* Align here to ensure that the .bss section occupies space up to
157b05deb9bSPeter Wemm      _end.  Align after .bss to ensure correct alignment even if the
158*8ba66bb8SDimitry Andric      .bss section disappears because there are no input sections.
159*8ba66bb8SDimitry Andric      FIXME: Why do we need it? When there is no .bss section, we don't
160*8ba66bb8SDimitry Andric      pad the .data section.  */
161*8ba66bb8SDimitry Andric   . = ALIGN(. != 0 ? 64 / 8 : 1);
162*8ba66bb8SDimitry Andric  }
163*8ba66bb8SDimitry Andric  .lbss   :
164*8ba66bb8SDimitry Andric  {
165*8ba66bb8SDimitry Andric    *(.dynlbss)
166*8ba66bb8SDimitry Andric    *(.lbss .lbss.* .gnu.linkonce.lb.*)
167*8ba66bb8SDimitry Andric    *(LARGE_COMMON)
1686b7a14ceSPeter Wemm  }
169b05deb9bSPeter Wemm  . = ALIGN(64 / 8);
170*8ba66bb8SDimitry Andric  .lrodata   ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)) :
171*8ba66bb8SDimitry Andric  {
172*8ba66bb8SDimitry Andric    *(.lrodata .lrodata.* .gnu.linkonce.lr.*)
173*8ba66bb8SDimitry Andric  }
174*8ba66bb8SDimitry Andric  .ldata   ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)) :
175*8ba66bb8SDimitry Andric  {
176*8ba66bb8SDimitry Andric    *(.ldata .ldata.* .gnu.linkonce.l.*)
177*8ba66bb8SDimitry Andric    . = ALIGN(. != 0 ? 64 / 8 : 1);
178*8ba66bb8SDimitry Andric  }
179*8ba66bb8SDimitry Andric  . = ALIGN(64 / 8);
180*8ba66bb8SDimitry Andric  _end = .; PROVIDE (end = .);
181b05deb9bSPeter Wemm  . = DATA_SEGMENT_END (.);
1826b7a14ceSPeter Wemm  /* Stabs debugging sections.  */
1836b7a14ceSPeter Wemm  .stab          0 : { *(.stab) }
1846b7a14ceSPeter Wemm  .stabstr       0 : { *(.stabstr) }
1856b7a14ceSPeter Wemm  .stab.excl     0 : { *(.stab.excl) }
1866b7a14ceSPeter Wemm  .stab.exclstr  0 : { *(.stab.exclstr) }
1876b7a14ceSPeter Wemm  .stab.index    0 : { *(.stab.index) }
1886b7a14ceSPeter Wemm  .stab.indexstr 0 : { *(.stab.indexstr) }
1896b7a14ceSPeter Wemm  .comment       0 : { *(.comment) }
1906b7a14ceSPeter Wemm  /* DWARF debug sections.
1916b7a14ceSPeter Wemm     Symbols in the DWARF debugging sections are relative to the beginning
1926b7a14ceSPeter Wemm     of the section so we begin them at 0.  */
1936b7a14ceSPeter Wemm  /* DWARF 1 */
1946b7a14ceSPeter Wemm  .debug          0 : { *(.debug) }
1956b7a14ceSPeter Wemm  .line           0 : { *(.line) }
1966b7a14ceSPeter Wemm  /* GNU DWARF 1 extensions */
1976b7a14ceSPeter Wemm  .debug_srcinfo  0 : { *(.debug_srcinfo) }
1986b7a14ceSPeter Wemm  .debug_sfnames  0 : { *(.debug_sfnames) }
1996b7a14ceSPeter Wemm  /* DWARF 1.1 and DWARF 2 */
2006b7a14ceSPeter Wemm  .debug_aranges  0 : { *(.debug_aranges) }
2016b7a14ceSPeter Wemm  .debug_pubnames 0 : { *(.debug_pubnames) }
2026b7a14ceSPeter Wemm  /* DWARF 2 */
203b05deb9bSPeter Wemm  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
2046b7a14ceSPeter Wemm  .debug_abbrev   0 : { *(.debug_abbrev) }
2056b7a14ceSPeter Wemm  .debug_line     0 : { *(.debug_line) }
2066b7a14ceSPeter Wemm  .debug_frame    0 : { *(.debug_frame) }
2076b7a14ceSPeter Wemm  .debug_str      0 : { *(.debug_str) }
2086b7a14ceSPeter Wemm  .debug_loc      0 : { *(.debug_loc) }
2096b7a14ceSPeter Wemm  .debug_macinfo  0 : { *(.debug_macinfo) }
2106b7a14ceSPeter Wemm  /* SGI/MIPS DWARF 2 extensions */
2116b7a14ceSPeter Wemm  .debug_weaknames 0 : { *(.debug_weaknames) }
2126b7a14ceSPeter Wemm  .debug_funcnames 0 : { *(.debug_funcnames) }
2136b7a14ceSPeter Wemm  .debug_typenames 0 : { *(.debug_typenames) }
2146b7a14ceSPeter Wemm  .debug_varnames  0 : { *(.debug_varnames) }
215*8ba66bb8SDimitry Andric  /* DWARF 3 */
216*8ba66bb8SDimitry Andric  .debug_pubtypes 0 : { *(.debug_pubtypes) }
217*8ba66bb8SDimitry Andric  .debug_ranges   0 : { *(.debug_ranges) }
218*8ba66bb8SDimitry Andric  .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
219*8ba66bb8SDimitry Andric  /DISCARD/ : { *(.note.GNU-stack) }
2206b7a14ceSPeter Wemm}
221