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