kern.ldscript revision 1.1
11.1Sfvdl/*	$NetBSD: kern.ldscript,v 1.1 2003/04/26 18:39:35 fvdl Exp $	*/
21.1Sfvdl
31.1Sfvdl/*
41.1Sfvdl * Kernel linker script for NetBSD/amd64.  This script is based on
51.1Sfvdl * elf_x86_64.x, but puts _etext after all of the read-only sections.
61.1Sfvdl */
71.1Sfvdl
81.1Sfvdl/* Default linker script, for normal executables */
91.1SfvdlOUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64",
101.1Sfvdl	      "elf64-x86-64")
111.1SfvdlOUTPUT_ARCH(i386:x86-64)
121.1SfvdlENTRY(_start)
131.1Sfvdl SEARCH_DIR(/usr/local/gnu/x86_64-unknown-netbsd/lib);
141.1Sfvdl/* Do we need any of these for elf?
151.1Sfvdl   __DYNAMIC = 0;    */
161.1SfvdlSECTIONS
171.1Sfvdl{
181.1Sfvdl  /* Read-only sections, merged into text segment: */
191.1Sfvdl  . = 0x400000 + SIZEOF_HEADERS;
201.1Sfvdl  .interp         : { *(.interp) }
211.1Sfvdl  .hash           : { *(.hash) }
221.1Sfvdl  .dynsym         : { *(.dynsym) }
231.1Sfvdl  .dynstr         : { *(.dynstr) }
241.1Sfvdl  .gnu.version    : { *(.gnu.version) }
251.1Sfvdl  .gnu.version_d  : { *(.gnu.version_d) }
261.1Sfvdl  .gnu.version_r  : { *(.gnu.version_r) }
271.1Sfvdl  .rel.init       : { *(.rel.init) }
281.1Sfvdl  .rela.init      : { *(.rela.init) }
291.1Sfvdl  .rel.text       : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
301.1Sfvdl  .rela.text      : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
311.1Sfvdl  .rel.fini       : { *(.rel.fini) }
321.1Sfvdl  .rela.fini      : { *(.rela.fini) }
331.1Sfvdl  .rel.rodata     : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
341.1Sfvdl  .rela.rodata    : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
351.1Sfvdl  .rel.data       : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
361.1Sfvdl  .rela.data      : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
371.1Sfvdl  .rel.ctors      : { *(.rel.ctors) }
381.1Sfvdl  .rela.ctors     : { *(.rela.ctors) }
391.1Sfvdl  .rel.dtors      : { *(.rel.dtors) }
401.1Sfvdl  .rela.dtors     : { *(.rela.dtors) }
411.1Sfvdl  .rel.got        : { *(.rel.got) }
421.1Sfvdl  .rela.got       : { *(.rela.got) }
431.1Sfvdl  .rel.bss        : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
441.1Sfvdl  .rela.bss       : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
451.1Sfvdl  .rel.plt        : { *(.rel.plt) }
461.1Sfvdl  .rela.plt       : { *(.rela.plt) }
471.1Sfvdl  .init           :
481.1Sfvdl  {
491.1Sfvdl    KEEP (*(.init))
501.1Sfvdl  } =0x90909090
511.1Sfvdl  .plt            : { *(.plt) }
521.1Sfvdl  .text           :
531.1Sfvdl  {
541.1Sfvdl    *(.text .stub .text.* .gnu.linkonce.t.*)
551.1Sfvdl    /* .gnu.warning sections are handled specially by elf32.em.  */
561.1Sfvdl    *(.gnu.warning)
571.1Sfvdl  } =0x90909090
581.1Sfvdl  .fini           :
591.1Sfvdl  {
601.1Sfvdl    KEEP (*(.fini))
611.1Sfvdl  } =0x90909090
621.1Sfvdl  .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
631.1Sfvdl  .rodata1        : { *(.rodata1) }
641.1Sfvdl  .eh_frame_hdr : { *(.eh_frame_hdr) }
651.1Sfvdl  PROVIDE (__etext = .);
661.1Sfvdl  PROVIDE (_etext = .);
671.1Sfvdl  PROVIDE (etext = .);
681.1Sfvdl  /* Adjust the address for the data segment.  We want to adjust up to
691.1Sfvdl     the same address within the page on the next page up.  */
701.1Sfvdl  . = ALIGN(0x100000) + (. & (0x100000 - 1));
711.1Sfvdl  .data           :
721.1Sfvdl  {
731.1Sfvdl    *(.data .data.* .gnu.linkonce.d.*)
741.1Sfvdl    SORT(CONSTRUCTORS)
751.1Sfvdl  }
761.1Sfvdl  .data1          : { *(.data1) }
771.1Sfvdl  .eh_frame       : { KEEP (*(.eh_frame)) }
781.1Sfvdl  .gcc_except_table   : { *(.gcc_except_table) }
791.1Sfvdl  .dynamic        : { *(.dynamic) }
801.1Sfvdl  .ctors          :
811.1Sfvdl  {
821.1Sfvdl    /* gcc uses crtbegin.o to find the start of
831.1Sfvdl       the constructors, so we make sure it is
841.1Sfvdl       first.  Because this is a wildcard, it
851.1Sfvdl       doesn't matter if the user does not
861.1Sfvdl       actually link against crtbegin.o; the
871.1Sfvdl       linker won't look for a file to match a
881.1Sfvdl       wildcard.  The wildcard also means that it
891.1Sfvdl       doesn't matter which directory crtbegin.o
901.1Sfvdl       is in.  */
911.1Sfvdl    KEEP (*crtbegin.o(.ctors))
921.1Sfvdl    /* We don't want to include the .ctor section from
931.1Sfvdl       from the crtend.o file until after the sorted ctors.
941.1Sfvdl       The .ctor section from the crtend file contains the
951.1Sfvdl       end of ctors marker and it must be last */
961.1Sfvdl    KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
971.1Sfvdl    KEEP (*(SORT(.ctors.*)))
981.1Sfvdl    KEEP (*(.ctors))
991.1Sfvdl  }
1001.1Sfvdl  .dtors          :
1011.1Sfvdl  {
1021.1Sfvdl    KEEP (*crtbegin.o(.dtors))
1031.1Sfvdl    KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
1041.1Sfvdl    KEEP (*(SORT(.dtors.*)))
1051.1Sfvdl    KEEP (*(.dtors))
1061.1Sfvdl  }
1071.1Sfvdl  .jcr            : { KEEP (*(.jcr)) }
1081.1Sfvdl  .got            : { *(.got.plt) *(.got) }
1091.1Sfvdl  _edata = .;
1101.1Sfvdl  PROVIDE (edata = .);
1111.1Sfvdl  __bss_start = .;
1121.1Sfvdl  .bss            :
1131.1Sfvdl  {
1141.1Sfvdl   *(.dynbss)
1151.1Sfvdl   *(.bss .bss.* .gnu.linkonce.b.*)
1161.1Sfvdl   *(COMMON)
1171.1Sfvdl   /* Align here to ensure that the .bss section occupies space up to
1181.1Sfvdl      _end.  Align after .bss to ensure correct alignment even if the
1191.1Sfvdl      .bss section disappears because there are no input sections.  */
1201.1Sfvdl   . = ALIGN(64 / 8);
1211.1Sfvdl  }
1221.1Sfvdl  . = ALIGN(64 / 8);
1231.1Sfvdl  _end = .;
1241.1Sfvdl  PROVIDE (end = .);
1251.1Sfvdl  /* Stabs debugging sections.  */
1261.1Sfvdl  .stab          0 : { *(.stab) }
1271.1Sfvdl  .stabstr       0 : { *(.stabstr) }
1281.1Sfvdl  .stab.excl     0 : { *(.stab.excl) }
1291.1Sfvdl  .stab.exclstr  0 : { *(.stab.exclstr) }
1301.1Sfvdl  .stab.index    0 : { *(.stab.index) }
1311.1Sfvdl  .stab.indexstr 0 : { *(.stab.indexstr) }
1321.1Sfvdl  .comment       0 : { *(.comment) }
1331.1Sfvdl  /* DWARF debug sections.
1341.1Sfvdl     Symbols in the DWARF debugging sections are relative to the beginning
1351.1Sfvdl     of the section so we begin them at 0.  */
1361.1Sfvdl  /* DWARF 1 */
1371.1Sfvdl  .debug          0 : { *(.debug) }
1381.1Sfvdl  .line           0 : { *(.line) }
1391.1Sfvdl  /* GNU DWARF 1 extensions */
1401.1Sfvdl  .debug_srcinfo  0 : { *(.debug_srcinfo) }
1411.1Sfvdl  .debug_sfnames  0 : { *(.debug_sfnames) }
1421.1Sfvdl  /* DWARF 1.1 and DWARF 2 */
1431.1Sfvdl  .debug_aranges  0 : { *(.debug_aranges) }
1441.1Sfvdl  .debug_pubnames 0 : { *(.debug_pubnames) }
1451.1Sfvdl  /* DWARF 2 */
1461.1Sfvdl  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
1471.1Sfvdl  .debug_abbrev   0 : { *(.debug_abbrev) }
1481.1Sfvdl  .debug_line     0 : { *(.debug_line) }
1491.1Sfvdl  .debug_frame    0 : { *(.debug_frame) }
1501.1Sfvdl  .debug_str      0 : { *(.debug_str) }
1511.1Sfvdl  .debug_loc      0 : { *(.debug_loc) }
1521.1Sfvdl  .debug_macinfo  0 : { *(.debug_macinfo) }
1531.1Sfvdl  /* SGI/MIPS DWARF 2 extensions */
1541.1Sfvdl  .debug_weaknames 0 : { *(.debug_weaknames) }
1551.1Sfvdl  .debug_funcnames 0 : { *(.debug_funcnames) }
1561.1Sfvdl  .debug_typenames 0 : { *(.debug_typenames) }
1571.1Sfvdl  .debug_varnames  0 : { *(.debug_varnames) }
1581.1Sfvdl}
159