Home | History | Annotate | Download | only in ldscripts
      1 /* Script for --shared -z combreloc: shared library, combine & sort relocs */
      2 /* Modified for Android.  */
      3 OUTPUT_FORMAT("elf64-tradbigmips", "elf64-tradbigmips",
      4 	      "elf64-tradlittlemips")
      5 OUTPUT_ARCH(mips)
      6 ENTRY(__start)
      7 SECTIONS
      8 {
      9   /* Read-only sections, merged into text segment: */
     10   . = 0 + SIZEOF_HEADERS;
     11   .MIPS.options : { *(.MIPS.options) }
     12   .note.gnu.build-id : { *(.note.gnu.build-id) }
     13   .dynamic        : { *(.dynamic) }
     14   .hash           : { *(.hash) }
     15   .gnu.hash       : { *(.gnu.hash) }
     16   .dynsym         : { *(.dynsym) }
     17   .dynstr         : { *(.dynstr) }
     18   .gnu.version    : { *(.gnu.version) }
     19   .gnu.version_d  : { *(.gnu.version_d) }
     20   .gnu.version_r  : { *(.gnu.version_r) }
     21   .rel.dyn        :
     22     {
     23       *(.rel.init)
     24       *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
     25       *(.rel.fini)
     26       *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
     27       *(.rel.data.rel.ro .rel.data.rel.ro.* .rel.gnu.linkonce.d.rel.ro.*)
     28       *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
     29       *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
     30       *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
     31       *(.rel.ctors)
     32       *(.rel.dtors)
     33       *(.rel.got)
     34       *(.rel.dyn)
     35       *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*)
     36       *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*)
     37       *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*)
     38       *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*)
     39       *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
     40       *(.rel.iplt)
     41     }
     42   .rela.dyn       :
     43     {
     44       *(.rela.init)
     45       *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
     46       *(.rela.fini)
     47       *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
     48       *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
     49       *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
     50       *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
     51       *(.rela.ctors)
     52       *(.rela.dtors)
     53       *(.rela.got)
     54       *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*)
     55       *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*)
     56       *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*)
     57       *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*)
     58       *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
     59       *(.rela.iplt)
     60     }
     61   .rel.plt        :
     62     {
     63       *(.rel.plt)
     64     }
     65   .rela.plt       :
     66     {
     67       *(.rela.plt)
     68     }
     69   .init           :
     70   {
     71     KEEP (*(SORT_NONE(.init)))
     72   }
     73   .plt            : { *(.plt) }
     74   .iplt           : { *(.iplt) }
     75   .text           :
     76   {
     77     _ftext = . ;
     78     *(.text.unlikely .text.*_unlikely .text.unlikely.*)
     79     *(.text.exit .text.exit.*)
     80     *(.text.startup .text.startup.*)
     81     *(.text.hot .text.hot.*)
     82     *(.text .stub .text.* .gnu.linkonce.t.*)
     83     /* .gnu.warning sections are handled specially by elf32.em.  */
     84     *(.gnu.warning)
     85     *(.mips16.fn.*) *(.mips16.call.*)
     86   }
     87   .fini           :
     88   {
     89     KEEP (*(SORT_NONE(.fini)))
     90   }
     91   PROVIDE (__etext = .);
     92   PROVIDE (_etext = .);
     93   PROVIDE (etext = .);
     94   .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
     95   .rodata1        : { *(.rodata1) }
     96   .eh_frame_hdr : { *(.eh_frame_hdr) }
     97   .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }
     98   .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table
     99   .gcc_except_table.*) }
    100   /* These sections are generated by the Sun/Oracle C++ compiler.  */
    101   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
    102   .exception_ranges*) }
    103   /* Adjust the address for the data segment.  For 32 bits we want to align
    104   at exactly a page boundary to make life easier for apriori. */
    105   . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
    106   /* Exception handling  */
    107   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
    108   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
    109   .exception_ranges   : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) }
    110   /* Thread Local Storage sections  */
    111   .tdata	  : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
    112   .tbss		  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
    113   /* Ensure the __preinit_array_start label is properly aligned.  We
    114      could instead move the label definition inside the section, but
    115      the linker would then create the section even if it turns out to
    116      be empty, which isn't pretty.  */
    117   . = ALIGN(32 / 8);
    118   .preinit_array     :
    119   {
    120     KEEP (*(.preinit_array))
    121   }
    122   .init_array     :
    123   {
    124     KEEP (*crtbegin*.o(.init_array))
    125     KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
    126     KEEP (*(.init_array 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 EXCLUDE_FILE (*crtbegin.o *crtbegin*.o *crtend.o *crtend*.o ) .dtors))
    133   }
    134   .ctors          :
    135   {
    136     /* gcc uses crtbegin.o to find the start of
    137        the constructors, so we make sure it is
    138        first.  Because this is a wildcard, it
    139        doesn't matter if the user does not
    140        actually link against crtbegin.o; the
    141        linker won't look for a file to match a
    142        wildcard.  The wildcard also means that it
    143        doesn't matter which directory crtbegin.o
    144        is in.  */
    145     KEEP (*crtbegin.o(.ctors))
    146     KEEP (*crtbegin*.o(.ctors))
    147     /* We don't want to include the .ctor section from
    148        the crtend.o file until after the sorted ctors.
    149        The .ctor section from the crtend file contains the
    150        end of ctors marker and it must be last */
    151     KEEP (*(EXCLUDE_FILE (*crtend.o *crtend*.o ) .ctors))
    152     KEEP (*(SORT(.ctors.*)))
    153     KEEP (*(.ctors))
    154   }
    155   .dtors          :
    156   {
    157     KEEP (*crtbegin.o(.dtors))
    158     KEEP (*crtbegin*.o(.dtors))
    159     KEEP (*(EXCLUDE_FILE (*crtend.o *crtend*.o ) .dtors))
    160     KEEP (*(SORT(.dtors.*)))
    161     KEEP (*(.dtors))
    162   }
    163   .jcr            : { KEEP (*(.jcr)) }
    164   .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }
    165   . = DATA_SEGMENT_RELRO_END (0, .);
    166   .data           :
    167   {
    168     _fdata = . ;
    169     *(.data .data.* .gnu.linkonce.d.*)
    170     SORT(CONSTRUCTORS)
    171   }
    172   .data1          : { *(.data1) }
    173   .got.plt        : { *(.got.plt) }
    174   . = .;
    175   . = .;
    176   HIDDEN (_gp = ALIGN (16) + 0x7ff0);
    177   .got            : { *(.got) }
    178   /* We want the small data sections together, so single-instruction offsets
    179      can access them all, and initialized data all before uninitialized, so
    180      we can shorten the on-disk segment size.  */
    181   .sdata          :
    182   {
    183     *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
    184     *(.sdata .sdata.* .gnu.linkonce.s.*)
    185   }
    186   .lit8           : { *(.lit8) }
    187   .lit4           : { *(.lit4) }
    188   .srdata         : { *(.srdata) }
    189   _edata = .; PROVIDE (edata = .);
    190   . = .;
    191   __bss_start = .;
    192   _fbss = .;
    193   .sbss           :
    194   {
    195     *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
    196     *(.dynsbss)
    197     *(.sbss .sbss.* .gnu.linkonce.sb.*)
    198     *(.scommon)
    199   }
    200   .bss            :
    201   {
    202    *(.dynbss)
    203    *(.bss .bss.* .gnu.linkonce.b.*)
    204    *(COMMON)
    205    /* Align here to ensure that the .bss section occupies space up to
    206       _end.  Align after .bss to ensure correct alignment even if the
    207       .bss section disappears because there are no input sections.  */
    208    . = ALIGN(64 / 8);
    209   }
    210   . = ALIGN(64 / 8);
    211   . = SEGMENT_START("ldata-segment", .);
    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 .debug_line.* .debug_line_end ) }
    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