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