Home | History | Annotate | Line # | Download | only in conf
kern.ldscript revision 1.1.2.2
      1 /* Script for -n: mix text and data on same page */
      2 OUTPUT_FORMAT("elf64-littleriscv")
      3 OUTPUT_ARCH(riscv)
      4 ENTRY(_start)
      5 SEARCH_DIR("/lib");
      6 SECTIONS
      7 {
      8   /* Read-only sections, merged into text segment: */
      9   PROVIDE (__executable_start = SEGMENT_START("text-segment", 0xffffffff80000000)); . = SEGMENT_START("text-segment", 0xffffffff80000000) + SIZEOF_HEADERS;
     10   .rel.rodata     : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
     11   .rela.rodata    : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
     12   .rel.data.rel.ro   : { *(.rel.data.rel.ro .rel.data.rel.ro.* .rel.gnu.linkonce.d.rel.ro.*) }
     13   .rela.data.rel.ro   : { *(.rela.data.rel.ro .rela.data.rel.ro.* .rela.gnu.linkonce.d.rel.ro.*) }
     14   .rel.data       : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
     15   .rela.data      : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
     16   .rel.tdata	  : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
     17   .rela.tdata	  : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
     18   .rel.tbss	  : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
     19   .rela.tbss	  : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
     20   .rel.sdata      : { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) }
     21   .rela.sdata     : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) }
     22   .rel.sbss       : { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) }
     23   .rela.sbss      : { *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) }
     24   .rel.sdata2     : { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) }
     25   .rela.sdata2    : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) }
     26   .rel.sbss2      : { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) }
     27   .rela.sbss2     : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) }
     28   .rel.bss        : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
     29   .rela.bss       : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
     30   .text           :
     31   {
     32     _ftext = . ;
     33     *(.text)
     34     *(.text.unlikely .text.*_unlikely)
     35     *(.text.exit .text.exit.*)
     36     *(.text.startup .text.startup.*)
     37     *(.text.hot .text.hot.*)
     38     *(.stub .text.* .gnu.linkonce.t.*)
     39   }
     40   PROVIDE (__etext = .);
     41   PROVIDE (_etext = .);
     42   PROVIDE (etext = .);
     43   .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
     44   .rodata1        : { *(.rodata1) }
     45   .sdata2         :
     46   {
     47     *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
     48   }
     49   .sbss2          : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) }
     50   .eh_frame_hdr : { *(.eh_frame_hdr) }
     51   .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }
     52   /* These sections are generated by the Sun/Oracle C++ compiler.  */
     53   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
     54   .exception_ranges*) }
     55   /* Adjust the address for the data segment.  We want to adjust up to
     56      the same address within the page on the next page up.  */
     57   . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
     58   /* Exception handling  */
     59   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
     60   .exception_ranges   : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) }
     61   .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }
     62   . = DATA_SEGMENT_RELRO_END (0, .);
     63   .data           :
     64   {
     65     _fdata = . ;
     66     *(.data .data.* .gnu.linkonce.d.*)
     67     SORT(CONSTRUCTORS)
     68   }
     69   .data1          : { *(.data1) }
     70   /* We want the small data sections together, so single-instruction offsets
     71      can access them all, and initialized data all before uninitialized, so
     72      we can shorten the on-disk segment size.  */
     73   .sdata          :
     74   {
     75     /*_gp = . + 0x800;*/
     76     *(.srodata.cst16) *(.srodata.cst8) *(.srodata.cst4) *(.srodata.cst2) *(.srodata*)
     77     *(.sdata .sdata.* .gnu.linkonce.s.*)
     78   }
     79   _edata = .; PROVIDE (edata = .);
     80   . = .;
     81   __bss_start = .;
     82   _fbss = .;
     83   .sbss           :
     84   {
     85     *(.dynsbss)
     86     *(.sbss .sbss.* .gnu.linkonce.sb.*)
     87     *(.scommon)
     88   }
     89   .bss            :
     90   {
     91    *(.dynbss)
     92    *(.bss .bss.* .gnu.linkonce.b.*)
     93    *(COMMON)
     94    /* Align here to ensure that the .bss section occupies space up to
     95       _end.  Align after .bss to ensure correct alignment even if the
     96       .bss section disappears because there are no input sections.
     97       FIXME: Why do we need it? When there is no .bss section, we don't
     98       pad the .data section.  */
     99    . = ALIGN(. != 0 ? 64 / 8 : 1);
    100   }
    101   . = ALIGN(64 / 8);
    102   _end = .; PROVIDE (end = .);
    103   . = DATA_SEGMENT_END (.);
    104   /* Stabs debugging sections.  */
    105   .stab          0 : { *(.stab) }
    106   .stabstr       0 : { *(.stabstr) }
    107   .stab.excl     0 : { *(.stab.excl) }
    108   .stab.exclstr  0 : { *(.stab.exclstr) }
    109   .stab.index    0 : { *(.stab.index) }
    110   .stab.indexstr 0 : { *(.stab.indexstr) }
    111   .comment       0 : { *(.comment) }
    112   /* DWARF debug sections.
    113      Symbols in the DWARF debugging sections are relative to the beginning
    114      of the section so we begin them at 0.  */
    115   /* DWARF 1 */
    116   .debug          0 : { *(.debug) }
    117   .line           0 : { *(.line) }
    118   /* GNU DWARF 1 extensions */
    119   .debug_srcinfo  0 : { *(.debug_srcinfo) }
    120   .debug_sfnames  0 : { *(.debug_sfnames) }
    121   /* DWARF 1.1 and DWARF 2 */
    122   .debug_aranges  0 : { *(.debug_aranges) }
    123   .debug_pubnames 0 : { *(.debug_pubnames) }
    124   /* DWARF 2 */
    125   .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
    126   .debug_abbrev   0 : { *(.debug_abbrev) }
    127   .debug_line     0 : { *(.debug_line) }
    128   .debug_frame    0 : { *(.debug_frame) }
    129   .debug_str      0 : { *(.debug_str) }
    130   .debug_loc      0 : { *(.debug_loc) }
    131   .debug_macinfo  0 : { *(.debug_macinfo) }
    132   /* SGI/MIPS DWARF 2 extensions */
    133   .debug_weaknames 0 : { *(.debug_weaknames) }
    134   .debug_funcnames 0 : { *(.debug_funcnames) }
    135   .debug_typenames 0 : { *(.debug_typenames) }
    136   .debug_varnames  0 : { *(.debug_varnames) }
    137   /* DWARF 3 */
    138   .debug_pubtypes 0 : { *(.debug_pubtypes) }
    139   .debug_ranges   0 : { *(.debug_ranges) }
    140   /* DWARF Extension.  */
    141   .debug_macro    0 : { *(.debug_macro) }
    142   .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
    143   .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
    144   .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
    145   /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
    146 }
    147