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