Home | History | Annotate | Download | only in ldscripts
      1 /* Script for -n: mix text and data on same page */
      2 OUTPUT_FORMAT("elf64-tradlittlemips", "elf64-tradbigmips",
      3 	      "elf64-tradlittlemips")
      4 OUTPUT_ARCH(mips)
      5 ENTRY(__start)
      6 SECTIONS
      7 {
      8   /* Read-only sections, merged into text segment: */
      9   PROVIDE (__executable_start = 0x120000000); . = 0x120000000 + SIZEOF_HEADERS;
     10   .MIPS.options : { *(.MIPS.options) }
     11   .note.gnu.build-id : { *(.note.gnu.build-id) }
     12   .dynamic        : { *(.dynamic) }
     13   .hash           : { *(.hash) }
     14   .gnu.hash       : { *(.gnu.hash) }
     15   .dynsym         : { *(.dynsym) }
     16   .dynstr         : { *(.dynstr) }
     17   .gnu.version    : { *(.gnu.version) }
     18   .gnu.version_d  : { *(.gnu.version_d) }
     19   .gnu.version_r  : { *(.gnu.version_r) }
     20   .rel.init       : { *(.rel.init) }
     21   .rela.init      : { *(.rela.init) }
     22   .rel.text       : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
     23   .rela.text      : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
     24   .rel.fini       : { *(.rel.fini) }
     25   .rela.fini      : { *(.rela.fini) }
     26   .rel.rodata     : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
     27   .rela.rodata    : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
     28   .rel.data.rel.ro   : { *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) }
     29   .rela.data.rel.ro   : { *(.rela.data.rel.ro* .rela.gnu.linkonce.d.rel.ro.*) }
     30   .rel.data       : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
     31   .rela.data      : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
     32   .rel.tdata	  : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
     33   .rela.tdata	  : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
     34   .rel.tbss	  : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
     35   .rela.tbss	  : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
     36   .rel.ctors      : { *(.rel.ctors) }
     37   .rela.ctors     : { *(.rela.ctors) }
     38   .rel.dtors      : { *(.rel.dtors) }
     39   .rela.dtors     : { *(.rela.dtors) }
     40   .rel.got        : { *(.rel.got) }
     41   .rela.got       : { *(.rela.got) }
     42   .rel.dyn        : { *(.rel.dyn) }
     43   .rel.sdata      : { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) }
     44   .rela.sdata     : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) }
     45   .rel.sbss       : { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) }
     46   .rela.sbss      : { *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) }
     47   .rel.sdata2     : { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) }
     48   .rela.sdata2    : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) }
     49   .rel.sbss2      : { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) }
     50   .rela.sbss2     : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) }
     51   .rel.bss        : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
     52   .rela.bss       : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
     53   .rel.iplt       :
     54     {
     55       PROVIDE_HIDDEN (__rel_iplt_start = .);
     56       *(.rel.iplt)
     57       PROVIDE_HIDDEN (__rel_iplt_end = .);
     58     }
     59   .rela.iplt      :
     60     {
     61       PROVIDE_HIDDEN (__rela_iplt_start = .);
     62       *(.rela.iplt)
     63       PROVIDE_HIDDEN (__rela_iplt_end = .);
     64     }
     65   .rel.plt        :
     66     {
     67       *(.rel.plt)
     68     }
     69   .rela.plt       :
     70     {
     71       *(.rela.plt)
     72     }
     73   .init           :
     74   {
     75     KEEP (*(.init))
     76   } =0
     77   .plt            : { *(.plt) }
     78   .iplt           : { *(.iplt) }
     79   .text           :
     80   {
     81     _ftext = . ;
     82     *(.text.unlikely .text.*_unlikely)
     83     *(.text.exit .text.exit.*)
     84     *(.text.startup .text.startup.*)
     85     *(.text.hot .text.hot.*)
     86     *(.text .stub .text.* .gnu.linkonce.t.*)
     87     /* .gnu.warning sections are handled specially by elf32.em.  */
     88     *(.gnu.warning)
     89     *(.mips16.fn.*) *(.mips16.call.*)
     90   } =0
     91   .fini           :
     92   {
     93     KEEP (*(.fini))
     94   } =0
     95   PROVIDE (__etext = .);
     96   PROVIDE (_etext = .);
     97   PROVIDE (etext = .);
     98   .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
     99   .rodata1        : { *(.rodata1) }
    100   .sdata2         :
    101   {
    102     *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
    103   }
    104   .sbss2          : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) }
    105   .eh_frame_hdr : { *(.eh_frame_hdr) }
    106   .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }
    107   .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
    108   /* Adjust the address for the data segment.  We want to align at exactly
    109      a page boundary to make life easier for apriori. */
    110   . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
    111   /* Exception handling  */
    112   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
    113   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
    114   /* Thread Local Storage sections  */
    115   .tdata	  : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
    116   .tbss		  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
    117   /* Ensure the __preinit_array_start label is properly aligned.  We
    118      could instead move the label definition inside the section, but
    119      the linker would then create the section even if it turns out to
    120      be empty, which isn't pretty.  */
    121   . = ALIGN(32 / 8);
    122   PROVIDE_HIDDEN (__preinit_array_start = .);
    123   .preinit_array     :
    124   {
    125     KEEP (*(.preinit_array))
    126   }
    127   PROVIDE_HIDDEN (__preinit_array_end = .);
    128   PROVIDE_HIDDEN (__init_array_start = .);
    129   .init_array     :
    130   {
    131     KEEP (*crtbegin*.o(.init_array))
    132     KEEP (*(SORT(.init_array.*)))
    133     KEEP (*(.init_array))
    134   }
    135   PROVIDE_HIDDEN (__init_array_end = .);
    136   PROVIDE_HIDDEN (__fini_array_start = .);
    137   .fini_array     :
    138   {
    139     KEEP (*crtbegin*.o(.fini_array))
    140     KEEP (*(SORT(.fini_array.*)))
    141     KEEP (*(.fini_array))
    142   }
    143   PROVIDE_HIDDEN (__fini_array_end = .);
    144   .ctors          :
    145   {
    146     /* gcc uses crtbegin.o to find the start of
    147        the constructors, so we make sure it is
    148        first.  Because this is a wildcard, it
    149        doesn't matter if the user does not
    150        actually link against crtbegin.o; the
    151        linker won't look for a file to match a
    152        wildcard.  The wildcard also means that it
    153        doesn't matter which directory crtbegin.o
    154        is in.  */
    155     KEEP (*crtbegin.o(.ctors))
    156     KEEP (*crtbegin*.o(.ctors))
    157     /* We don't want to include the .ctor section from
    158        the crtend.o file until after the sorted ctors.
    159        The .ctor section from the crtend file contains the
    160        end of ctors marker and it must be last */
    161     KEEP (*(EXCLUDE_FILE (*crtend.o *crtend*.o ) .ctors))
    162     KEEP (*(SORT(.ctors.*)))
    163     KEEP (*(.ctors))
    164   }
    165   .dtors          :
    166   {
    167     KEEP (*crtbegin.o(.dtors))
    168     KEEP (*crtbegin*.o(.dtors))
    169     KEEP (*(EXCLUDE_FILE (*crtend.o *crtend*.o ) .dtors))
    170     KEEP (*(SORT(.dtors.*)))
    171     KEEP (*(.dtors))
    172   }
    173   .jcr            : { KEEP (*(.jcr)) }
    174   .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
    175   . = DATA_SEGMENT_RELRO_END (0, .);
    176   .data           :
    177   {
    178     _fdata = . ;
    179     *(.data .data.* .gnu.linkonce.d.*)
    180     SORT(CONSTRUCTORS)
    181   }
    182   .data1          : { *(.data1) }
    183   .got.plt        : { *(.got.plt) }
    184   . = .;
    185   _gp = ALIGN(16) + 0x7ff0;
    186   .got            : { *(.got) }
    187   /* We want the small data sections together, so single-instruction offsets
    188      can access them all, and initialized data all before uninitialized, so
    189      we can shorten the on-disk segment size.  */
    190   .sdata          :
    191   {
    192     *(.sdata .sdata.* .gnu.linkonce.s.*)
    193   }
    194   .lit8           : { *(.lit8) }
    195   .lit4           : { *(.lit4) }
    196   .srdata         : { *(.srdata) }
    197   _edata = .; PROVIDE (edata = .);
    198   __bss_start = .;
    199   _fbss = .;
    200   .sbss           :
    201   {
    202     *(.dynsbss)
    203     *(.sbss .sbss.* .gnu.linkonce.sb.*)
    204     *(.scommon)
    205   }
    206   .bss            :
    207   {
    208    *(.dynbss)
    209    *(.bss .bss.* .gnu.linkonce.b.*)
    210    *(COMMON)
    211    /* Align here to ensure that the .bss section occupies space up to
    212       _end.  Align after .bss to ensure correct alignment even if the
    213       .bss section disappears because there are no input sections.  */
    214    . = ALIGN(64 / 8);
    215   }
    216   . = ALIGN(64 / 8);
    217   . = ALIGN(64 / 8);
    218   _end = .;
    219   _bss_end__ = . ; __bss_end__ = . ; __end__ = . ;
    220   PROVIDE (end = .);
    221   . = DATA_SEGMENT_END (.);
    222   /* Stabs debugging sections.  */
    223   .stab          0 : { *(.stab) }
    224   .stabstr       0 : { *(.stabstr) }
    225   .stab.excl     0 : { *(.stab.excl) }
    226   .stab.exclstr  0 : { *(.stab.exclstr) }
    227   .stab.index    0 : { *(.stab.index) }
    228   .stab.indexstr 0 : { *(.stab.indexstr) }
    229   .comment       0 : { *(.comment) }
    230   /* DWARF debug sections.
    231      Symbols in the DWARF debugging sections are relative to the beginning
    232      of the section so we begin them at 0.  */
    233   /* DWARF 1 */
    234   .debug          0 : { *(.debug) }
    235   .line           0 : { *(.line) }
    236   /* GNU DWARF 1 extensions */
    237   .debug_srcinfo  0 : { *(.debug_srcinfo .zdebug_srcinfo) }
    238   .debug_sfnames  0 : { *(.debug_sfnames .zdebug_sfnames) }
    239   /* DWARF 1.1 and DWARF 2 */
    240   .debug_aranges  0 : { *(.debug_aranges .zdebug_aranges) }
    241   .debug_pubnames 0 : { *(.debug_pubnames .zdebug_pubnames) }
    242   /* DWARF 2 */
    243   .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.* .zdebug_info) }
    244   .debug_abbrev   0 : { *(.debug_abbrev .zdebug_abbrev) }
    245   .debug_line     0 : { *(.debug_line .zdebug_line) }
    246   .debug_frame    0 : { *(.debug_frame .zdebug_frame) }
    247   .debug_str      0 : { *(.debug_str .zdebug_str) }
    248   .debug_loc      0 : { *(.debug_loc .zdebug_loc) }
    249   .debug_macinfo  0 : { *(.debug_macinfo .zdebug_macinfo) }
    250   /* SGI/MIPS DWARF 2 extensions */
    251   .debug_weaknames 0 : { *(.debug_weaknames .zdebug_weaknames) }
    252   .debug_funcnames 0 : { *(.debug_funcnames .zdebug_funcnames) }
    253   .debug_typenames 0 : { *(.debug_typenames .zdebug_typenames) }
    254   .debug_varnames  0 : { *(.debug_varnames .zdebug_varnames) }
    255   /* DWARF 3 */
    256   .debug_pubtypes 0 : { *(.debug_pubtypes .zdebug_pubtypes) }
    257   .debug_ranges   0 : { *(.debug_ranges .zdebug_ranges) }
    258   .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
    259   .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
    260   .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
    261   /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.mdebug.*) }
    262 }
    263