kern.ldscript revision 1.7
11.7Suebayasi/* $NetBSD: kern.ldscript,v 1.7 2015/08/20 07:00:49 uebayasi Exp $ */
21.2Smatt
31.6Smrg/*  ldscript for NetBSD/powerpc kernels and LKMs, based on elf32ppc.x */
41.6SmrgOUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc",
51.6Smrg	      "elf32-powerpc")
61.6SmrgOUTPUT_ARCH(powerpc:common)
71.2SmattENTRY(_start)
81.2SmattSEARCH_DIR(/lib);
91.2Smatt/* Do we need any of these?
101.2Smatt   __DYNAMIC = 0;    */
111.2Smatt_DYNAMIC_LINK = 0;
121.2SmattSECTIONS
131.2Smatt{
141.2Smatt  /*  Read-only sections, merged into text segment.  Assumes the
151.2Smatt      kernel Makefile sets the start address via -Ttext.  */
161.2Smatt  .text      :
171.2Smatt  {
181.2Smatt    _ftext = . ;
191.6Smrg    PROVIDE_HIDDEN (__eprol = .);
201.2Smatt    *(.text)
211.6Smrg    *(.text.unlikely .text.*_unlikely)
221.6Smrg    *(.text.exit .text.exit.*)
231.6Smrg    *(.text.startup .text.startup.*)
241.6Smrg    *(.text.hot .text.hot.*)
251.6Smrg    *(.text.* .gnu.linkonce.t.*)
261.2Smatt    __stub_start = .;
271.2Smatt    *(.stub)
281.2Smatt    __stub_end = .;
291.4Smatt    __stub_pmap_start = .;
301.4Smatt    *(.stub.pmap)
311.4Smatt    __stub_pmap_end = .;
321.6Smrg    /* .gnu.warning sections are handled specially by elf32.em.  */
331.2Smatt    *(.gnu.warning)
341.6Smrg    *(.glink)
351.2Smatt  } =0
361.2Smatt  _etext = .;
371.6Smrg  PROVIDE (__etext = .);
381.6Smrg  PROVIDE (_etext = .);
391.2Smatt  PROVIDE (etext = .);
401.6Smrg  .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
411.6Smrg  .rodata1        : { *(.rodata1) }
421.6Smrg  .sdata2         :
431.6Smrg  {
441.6Smrg    PROVIDE (_SDA2_BASE_ = 32768);
451.6Smrg    *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
461.6Smrg  }
471.6Smrg  .sbss2          : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) }
481.6Smrg  /*.jcr            : { KEEP (*(.jcr)) } */ /* XXX??? */
491.2Smatt  .reginfo : { *(.reginfo) }
501.2Smatt/*  . = . + 0x1000; */
511.6Smrg  .data           :
521.2Smatt  {
531.2Smatt    _fdata = . ;
541.6Smrg    *(.data .data.* .gnu.linkonce.d.*)
551.6Smrg    SORT(CONSTRUCTORS)
561.2Smatt  }
571.6Smrg  .data1          : { *(.data1) }
581.3Smatt  . = ALIGN(32);	/* COHERENCY UNIT */
591.3Smatt  .data.cacheline_aligned	: { *(.data.cacheline_aligned) }
601.3Smatt  . = ALIGN(32);	/* COHERENCY UNIT */
611.3Smatt  .data.read_mostly		: { *(.data.read_mostly) }
621.3Smatt  . = ALIGN(32);	/* COHERENCY UNIT */
631.2Smatt  _gp = ALIGN(16) + 0x7ff0;
641.2Smatt  .lit8 : { *(.lit8) }
651.2Smatt  .lit4 : { *(.lit4) }
661.6Smrg  .sdata          :
671.6Smrg  {
681.6Smrg    PROVIDE (_SDA_BASE_ = 32768);
691.6Smrg    *(.sdata .sdata.* .gnu.linkonce.s.*)
701.6Smrg  }
711.6Smrg  _edata = .; PROVIDE (edata = .);
721.6Smrg  . = .;
731.2Smatt  __bss_start = .;
741.2Smatt  _fbss = .;
751.6Smrg  .sbss           :
761.2Smatt  {
771.6Smrg    PROVIDE (__sbss_start = .); PROVIDE (___sbss_start = .);
781.6Smrg    *(.dynsbss)
791.6Smrg    *(.sbss .sbss.* .gnu.linkonce.sb.*)
801.6Smrg    *(.scommon)
811.6Smrg    PROVIDE (__sbss_end = .); PROVIDE (___sbss_end = .);
821.6Smrg  }
831.6Smrg  .bss            :
841.6Smrg  {
851.7Suebayasi    *(.dynbss)
861.7Suebayasi    *(.bss .bss.* .gnu.linkonce.b.*)
871.7Suebayasi    *(COMMON)
881.7Suebayasi    /* Align here to ensure that the .bss section occupies space up to
891.7Suebayasi       _end.  Align after .bss to ensure correct alignment even if the
901.7Suebayasi       .bss section disappears because there are no input sections.
911.7Suebayasi       FIXME: Why do we need it? When there is no .bss section, we don't
921.7Suebayasi       pad the .data section.  */
931.7Suebayasi    . = ALIGN(. != 0 ? 32 / 8 : 1);
941.2Smatt  }
951.6Smrg  . = ALIGN(32 / 8);
961.6Smrg  . = ALIGN(32 / 8);
971.6Smrg  __end = .;
981.6Smrg  _end = .; PROVIDE (end = .);
991.6Smrg  /* . = DATA_SEGMENT_END (.); */
1001.6Smrg  /* Stabs debugging sections.  */
1011.6Smrg  .stab          0 : { *(.stab) }
1021.6Smrg  .stabstr       0 : { *(.stabstr) }
1031.6Smrg  .stab.excl     0 : { *(.stab.excl) }
1041.6Smrg  .stab.exclstr  0 : { *(.stab.exclstr) }
1051.6Smrg  .stab.index    0 : { *(.stab.index) }
1061.6Smrg  .stab.indexstr 0 : { *(.stab.indexstr) }
1071.6Smrg  .comment       0 : { *(.comment) }
1081.2Smatt  /* DWARF debug sections.
1091.6Smrg     Symbols in the DWARF debugging sections are relative to the beginning
1101.6Smrg     of the section so we begin them at 0.  */
1111.6Smrg  /* DWARF 1 */
1121.2Smatt  .debug          0 : { *(.debug) }
1131.6Smrg  .line           0 : { *(.line) }
1141.6Smrg  /* GNU DWARF 1 extensions */
1151.2Smatt  .debug_srcinfo  0 : { *(.debug_srcinfo) }
1161.6Smrg  .debug_sfnames  0 : { *(.debug_sfnames) }
1171.6Smrg  /* DWARF 1.1 and DWARF 2 */
1181.2Smatt  .debug_aranges  0 : { *(.debug_aranges) }
1191.2Smatt  .debug_pubnames 0 : { *(.debug_pubnames) }
1201.6Smrg  /* DWARF 2 */
1211.6Smrg  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
1221.6Smrg  .debug_abbrev   0 : { *(.debug_abbrev) }
1231.6Smrg  .debug_line     0 : { *(.debug_line) }
1241.6Smrg  .debug_frame    0 : { *(.debug_frame) }
1251.6Smrg  .debug_str      0 : { *(.debug_str) }
1261.6Smrg  .debug_loc      0 : { *(.debug_loc) }
1271.6Smrg  .debug_macinfo  0 : { *(.debug_macinfo) }
1281.6Smrg  /* SGI/MIPS DWARF 2 extensions */
1291.6Smrg  .debug_weaknames 0 : { *(.debug_weaknames) }
1301.6Smrg  .debug_funcnames 0 : { *(.debug_funcnames) }
1311.6Smrg  .debug_typenames 0 : { *(.debug_typenames) }
1321.6Smrg  .debug_varnames  0 : { *(.debug_varnames) }
1331.6Smrg  /* DWARF 3 */
1341.6Smrg  .debug_pubtypes 0 : { *(.debug_pubtypes) }
1351.6Smrg  .debug_ranges   0 : { *(.debug_ranges) }
1361.6Smrg  /* DWARF Extension.  */
1371.6Smrg  .debug_macro    0 : { *(.debug_macro) }
1381.6Smrg  .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
1391.2Smatt  .line           0 : { *(.line) }
1401.2Smatt  /* These must appear regardless of  .  */
1411.2Smatt  .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
1421.2Smatt  .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
1431.2Smatt}
144