Home | History | Annotate | Line # | Download | only in conf
kern.ldscript revision 1.5
      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 }
     83