xref: /freebsd/sys/conf/ldscript.i386 (revision e15b5ba77d693609c9a452d1b0a1cdd5eb29350d)
1616d2d5dSDavid E. O'BrienOUTPUT_FORMAT("elf32-i386-freebsd", "elf32-i386-freebsd", "elf32-i386-freebsd")
26b7a14ceSPeter WemmOUTPUT_ARCH(i386)
36b7a14ceSPeter WemmENTRY(btext)
45004cc2eSPeter WemmSEARCH_DIR(/usr/lib);
56b7a14ceSPeter WemmSECTIONS
66b7a14ceSPeter Wemm{
76b7a14ceSPeter Wemm  /* Read-only sections, merged into text segment: */
8d86c1f0dSKonstantin Belousov  . = kernbase + SIZEOF_HEADERS;
96b7a14ceSPeter Wemm  .interp         : { *(.interp) }
106b7a14ceSPeter Wemm  .hash           : { *(.hash) }
11f646247dSDimitry Andric  .gnu.hash       : { *(.gnu.hash) }
126b7a14ceSPeter Wemm  .dynsym         : { *(.dynsym) }
136b7a14ceSPeter Wemm  .dynstr         : { *(.dynstr) }
146b7a14ceSPeter Wemm  .gnu.version    : { *(.gnu.version) }
156b7a14ceSPeter Wemm  .gnu.version_d  : { *(.gnu.version_d) }
166b7a14ceSPeter Wemm  .gnu.version_r  : { *(.gnu.version_r) }
170dd487b0SDimitry Andric  .rel.init       : { *(.rel.init) }
180dd487b0SDimitry Andric  .rela.init      : { *(.rela.init) }
190dd487b0SDimitry Andric  .rel.text       : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
200dd487b0SDimitry Andric  .rela.text      : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
210dd487b0SDimitry Andric  .rel.fini       : { *(.rel.fini) }
220dd487b0SDimitry Andric  .rela.fini      : { *(.rela.fini) }
230dd487b0SDimitry Andric  .rel.rodata     : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
240dd487b0SDimitry Andric  .rela.rodata    : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
25f646247dSDimitry Andric  .rel.data.rel.ro   : { *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) }
26f646247dSDimitry Andric  .rela.data.rel.ro   : { *(.rela.data.rel.ro* .rela.gnu.linkonce.d.rel.ro.*) }
270dd487b0SDimitry Andric  .rel.data       : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
280dd487b0SDimitry Andric  .rela.data      : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
290dd487b0SDimitry Andric  .rel.tdata	  : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
300dd487b0SDimitry Andric  .rela.tdata	  : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
310dd487b0SDimitry Andric  .rel.tbss	  : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
320dd487b0SDimitry Andric  .rela.tbss	  : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
336b7a14ceSPeter Wemm  .rel.ctors      : { *(.rel.ctors) }
346b7a14ceSPeter Wemm  .rela.ctors     : { *(.rela.ctors) }
356b7a14ceSPeter Wemm  .rel.dtors      : { *(.rel.dtors) }
366b7a14ceSPeter Wemm  .rela.dtors     : { *(.rela.dtors) }
370dd487b0SDimitry Andric  .rel.got        : { *(.rel.got) }
380dd487b0SDimitry Andric  .rela.got       : { *(.rela.got) }
390dd487b0SDimitry Andric  .rel.bss        : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
400dd487b0SDimitry Andric  .rela.bss       : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
416b7a14ceSPeter Wemm  .rel.plt        : { *(.rel.plt) }
426b7a14ceSPeter Wemm  .rela.plt       : { *(.rela.plt) }
430dd487b0SDimitry Andric  .init           :
440dd487b0SDimitry Andric  {
450dd487b0SDimitry Andric    KEEP (*(.init))
46bd4e4054SEd Maste  } =0xCCCCCCCC
476b7a14ceSPeter Wemm  .plt            : { *(.plt) }
486b7a14ceSPeter Wemm  .text           :
496b7a14ceSPeter Wemm  {
500dd487b0SDimitry Andric    *(.text .stub .text.* .gnu.linkonce.t.*)
51f646247dSDimitry Andric    KEEP (*(.text.*personality*))
526b7a14ceSPeter Wemm    /* .gnu.warning sections are handled specially by elf32.em.  */
536b7a14ceSPeter Wemm    *(.gnu.warning)
54bd4e4054SEd Maste  } =0xCCCCCCCC
550dd487b0SDimitry Andric  .fini           :
560dd487b0SDimitry Andric  {
570dd487b0SDimitry Andric    KEEP (*(.fini))
58bd4e4054SEd Maste  } =0xCCCCCCCC
590dd487b0SDimitry Andric  PROVIDE (__etext = .);
600dd487b0SDimitry Andric  PROVIDE (_etext = .);
616b7a14ceSPeter Wemm  PROVIDE (etext = .);
620dd487b0SDimitry Andric  .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
636b7a14ceSPeter Wemm  .rodata1        : { *(.rodata1) }
6474cd06b4SEd Maste  .note.gnu.build-id : {
6574cd06b4SEd Maste    PROVIDE (__build_id_start = .);
6674cd06b4SEd Maste    *(.note.gnu.build-id)
6774cd06b4SEd Maste    PROVIDE (__build_id_end = .);
6874cd06b4SEd Maste  }
690dd487b0SDimitry Andric  .eh_frame_hdr : { *(.eh_frame_hdr) }
70f646247dSDimitry Andric  .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }
71f646247dSDimitry Andric  .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
726b7a14ceSPeter Wemm  /* Adjust the address for the data segment.  We want to adjust up to
736b7a14ceSPeter Wemm     the same address within the page on the next page up.  */
74f646247dSDimitry Andric  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
75f646247dSDimitry Andric  /* Exception handling  */
76f646247dSDimitry Andric  .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
77f646247dSDimitry Andric  .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
78f646247dSDimitry Andric  /* Thread Local Storage sections  */
790dd487b0SDimitry Andric  .tdata	  : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
800dd487b0SDimitry Andric  .tbss		  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
81f646247dSDimitry Andric  .preinit_array     :
82f646247dSDimitry Andric  {
83f646247dSDimitry Andric    PROVIDE_HIDDEN (__preinit_array_start = .);
84f646247dSDimitry Andric    KEEP (*(.preinit_array))
85f646247dSDimitry Andric    PROVIDE_HIDDEN (__preinit_array_end = .);
86f646247dSDimitry Andric  }
87f646247dSDimitry Andric  .init_array     :
88f646247dSDimitry Andric  {
89f646247dSDimitry Andric     PROVIDE_HIDDEN (__init_array_start = .);
90*e15b5ba7SZhenlei Huang     KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*)))
91f646247dSDimitry Andric     KEEP (*(.init_array))
92f646247dSDimitry Andric     PROVIDE_HIDDEN (__init_array_end = .);
93f646247dSDimitry Andric  }
94f646247dSDimitry Andric  .fini_array     :
95f646247dSDimitry Andric  {
96f646247dSDimitry Andric    PROVIDE_HIDDEN (__fini_array_start = .);
97*e15b5ba7SZhenlei Huang    KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*)))
98f646247dSDimitry Andric    KEEP (*(.fini_array))
99f646247dSDimitry Andric    PROVIDE_HIDDEN (__fini_array_end = .);
100f646247dSDimitry Andric  }
1013fc473dfSPoul-Henning Kamp  _start_ctors = .;
1023fc473dfSPoul-Henning Kamp  PROVIDE (start_ctors = .);
1036b7a14ceSPeter Wemm  .ctors          :
1046b7a14ceSPeter Wemm  {
1050dd487b0SDimitry Andric    /* gcc uses crtbegin.o to find the start of
1060dd487b0SDimitry Andric       the constructors, so we make sure it is
1070dd487b0SDimitry Andric       first.  Because this is a wildcard, it
1080dd487b0SDimitry Andric       doesn't matter if the user does not
1090dd487b0SDimitry Andric       actually link against crtbegin.o; the
1100dd487b0SDimitry Andric       linker won't look for a file to match a
1110dd487b0SDimitry Andric       wildcard.  The wildcard also means that it
1120dd487b0SDimitry Andric       doesn't matter which directory crtbegin.o
1130dd487b0SDimitry Andric       is in.  */
114f646247dSDimitry Andric    KEEP (*crtbegin.o(.ctors))
115f646247dSDimitry Andric    KEEP (*crtbegin?.o(.ctors))
1160dd487b0SDimitry Andric    /* We don't want to include the .ctor section from
117f646247dSDimitry Andric       the crtend.o file until after the sorted ctors.
1180dd487b0SDimitry Andric       The .ctor section from the crtend file contains the
1190dd487b0SDimitry Andric       end of ctors marker and it must be last */
120f646247dSDimitry Andric    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
1210dd487b0SDimitry Andric    KEEP (*(SORT(.ctors.*)))
1220dd487b0SDimitry Andric    KEEP (*(.ctors))
1236b7a14ceSPeter Wemm  }
1243fc473dfSPoul-Henning Kamp  _stop_ctors = .;
1253fc473dfSPoul-Henning Kamp  PROVIDE (stop_ctors = .);
1266b7a14ceSPeter Wemm  .dtors          :
1276b7a14ceSPeter Wemm  {
128f646247dSDimitry Andric    KEEP (*crtbegin.o(.dtors))
129f646247dSDimitry Andric    KEEP (*crtbegin?.o(.dtors))
130f646247dSDimitry Andric    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
1310dd487b0SDimitry Andric    KEEP (*(SORT(.dtors.*)))
1320dd487b0SDimitry Andric    KEEP (*(.dtors))
1336b7a14ceSPeter Wemm  }
1340dd487b0SDimitry Andric  .jcr            : { KEEP (*(.jcr)) }
135f646247dSDimitry Andric  .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
136f646247dSDimitry Andric  .dynamic        : { *(.dynamic) }
137f646247dSDimitry Andric  .got            : { *(.got) }
138f646247dSDimitry Andric  . = DATA_SEGMENT_RELRO_END (12, .);
139f646247dSDimitry Andric  .got.plt        : { *(.got.plt) }
140f646247dSDimitry Andric  .data           :
141f646247dSDimitry Andric  {
142f646247dSDimitry Andric    *(.data .data.* .gnu.linkonce.d.*)
143f646247dSDimitry Andric    KEEP (*(.gnu.linkonce.d.*personality*))
144f646247dSDimitry Andric  }
145f646247dSDimitry Andric  .data1          : { *(.data1) }
146f646247dSDimitry Andric  _edata = .; PROVIDE (edata = .);
1476b7a14ceSPeter Wemm  .bss            :
1486b7a14ceSPeter Wemm  {
149f3e1dfebSDimitry Andric   __bss_start = .;
1506b7a14ceSPeter Wemm   *(.dynbss)
1510dd487b0SDimitry Andric   *(.bss .bss.* .gnu.linkonce.b.*)
1526b7a14ceSPeter Wemm   *(COMMON)
1530dd487b0SDimitry Andric   /* Align here to ensure that the .bss section occupies space up to
1540dd487b0SDimitry Andric      _end.  Align after .bss to ensure correct alignment even if the
155f646247dSDimitry Andric      .bss section disappears because there are no input sections.
156f646247dSDimitry Andric      FIXME: Why do we need it? When there is no .bss section, we don't
157f646247dSDimitry Andric      pad the .data section.  */
158f646247dSDimitry Andric   . = ALIGN(. != 0 ? 32 / 8 : 1);
159f3e1dfebSDimitry Andric   __bss_end = .;
1606b7a14ceSPeter Wemm  }
1616b7a14ceSPeter Wemm  . = ALIGN(32 / 8);
162f646247dSDimitry Andric  . = ALIGN(32 / 8);
163f646247dSDimitry Andric  _end = .; PROVIDE (end = .);
1640dd487b0SDimitry Andric  . = DATA_SEGMENT_END (.);
16537d6d682SWarner Losh
16637d6d682SWarner Losh  /* Debug */
16737d6d682SWarner Losh  INCLUDE debuginfo.ldscript
16823dff4fdSWarner Losh
169f646247dSDimitry Andric  .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
1700dd487b0SDimitry Andric  /DISCARD/ : { *(.note.GNU-stack) }
1716b7a14ceSPeter Wemm}
172