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