Home | History | Annotate | Download | only in ldscripts
      1 /* Script for -z combreloc -z now -z relro: combine and sort reloc sections */
      2 OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm",
      3 	      "elf32-littlearm")
      4 OUTPUT_ARCH(arm)
      5 ENTRY(_start)
      6 SEARCH_DIR("/android/mathias/armdev/toolchain-eabi-4.2.1/arm-eabi/lib");
      7 SECTIONS
      8 {
      9   /* Read-only sections, merged into text segment: */
     10   PROVIDE (__executable_start = 0x8000); . = 0x8000;
     11   .interp         : { *(.interp) }
     12   .hash           : { *(.hash) }
     13   .dynsym         : { *(.dynsym) }
     14   .dynstr         : { *(.dynstr) }
     15   .gnu.version    : { *(.gnu.version) }
     16   .gnu.version_d  : { *(.gnu.version_d) }
     17   .gnu.version_r  : { *(.gnu.version_r) }
     18   .rel.dyn        :
     19     {
     20       *(.rel.init)
     21       *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
     22       *(.rel.fini)
     23       *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
     24       *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*)
     25       *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
     26       *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
     27       *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
     28       *(.rel.ctors)
     29       *(.rel.dtors)
     30       *(.rel.got)
     31       *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
     32     }
     33   .rela.dyn       :
     34     {
     35       *(.rela.init)
     36       *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
     37       *(.rela.fini)
     38       *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
     39       *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
     40       *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
     41       *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
     42       *(.rela.ctors)
     43       *(.rela.dtors)
     44       *(.rela.got)
     45       *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
     46     }
     47   .rel.plt        : { *(.rel.plt) }
     48   .rela.plt       : { *(.rela.plt) }
     49   .init           :
     50   {
     51     KEEP (*(.init))
     52   } =0
     53   .plt            : { *(.plt) }
     54   .text           :
     55   {
     56     *(.text .stub .text.* .gnu.linkonce.t.*)
     57     KEEP (*(.text.*personality*))
     58     /* .gnu.warning sections are handled specially by elf32.em.  */
     59     *(.gnu.warning)
     60     *(.glue_7t) *(.glue_7)
     61   } =0
     62   .fini           :
     63   {
     64     KEEP (*(.fini))
     65   } =0
     66   PROVIDE (__etext = .);
     67   PROVIDE (_etext = .);
     68   PROVIDE (etext = .);
     69   .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
     70   .rodata1        : { *(.rodata1) }
     71   .ARM.extab   : { *(.ARM.extab* .gnu.linkonce.armextab.*) }
     72    __exidx_start = .;
     73   .ARM.exidx   : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) }
     74    __exidx_end = .;
     75   .eh_frame_hdr : { *(.eh_frame_hdr) }
     76   .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }
     77   .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
     78   /* Adjust the address for the data segment.  We want to adjust up to
     79      the same address within the page on the next page up.  */
     80   . = ALIGN(256) + (. & (256 - 1));
     81   /* Exception handling  */
     82   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
     83   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
     84   /* Thread Local Storage sections  */
     85   .tdata	  : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
     86   .tbss		  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
     87   .preinit_array     :
     88   {
     89     PROVIDE_HIDDEN (__preinit_array_start = .);
     90     KEEP (*(.preinit_array))
     91     PROVIDE_HIDDEN (__preinit_array_end = .);
     92   }
     93   .init_array     :
     94   {
     95      PROVIDE_HIDDEN (__init_array_start = .);
     96      KEEP (*(SORT(.init_array.*)))
     97      KEEP (*(.init_array))
     98      PROVIDE_HIDDEN (__init_array_end = .);
     99   }
    100   .fini_array     :
    101   {
    102     PROVIDE_HIDDEN (__fini_array_start = .);
    103     KEEP (*(.fini_array))
    104     KEEP (*(SORT(.fini_array.*)))
    105     PROVIDE_HIDDEN (__fini_array_end = .);
    106   }
    107   .ctors          :
    108   {
    109     /* gcc uses crtbegin.o to find the start of
    110        the constructors, so we make sure it is
    111        first.  Because this is a wildcard, it
    112        doesn't matter if the user does not
    113        actually link against crtbegin.o; the
    114        linker won't look for a file to match a
    115        wildcard.  The wildcard also means that it
    116        doesn't matter which directory crtbegin.o
    117        is in.  */
    118     KEEP (*crtbegin*.o(.ctors))
    119     /* We don't want to include the .ctor section from
    120        the crtend.o file until after the sorted ctors.
    121        The .ctor section from the crtend file contains the
    122        end of ctors marker and it must be last */
    123     KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
    124     KEEP (*(SORT(.ctors.*)))
    125     KEEP (*(.ctors))
    126   }
    127   .dtors          :
    128   {
    129     KEEP (*crtbegin*.o(.dtors))
    130     KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
    131     KEEP (*(SORT(.dtors.*)))
    132     KEEP (*(.dtors))
    133   }
    134   .jcr            : { KEEP (*(.jcr)) }
    135   .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
    136   .dynamic        : { *(.dynamic) }
    137   .got            : { *(.got.plt) *(.got) }
    138   .data           :
    139   {
    140     __data_start = . ;
    141     *(.data .data.* .gnu.linkonce.d.*)
    142     KEEP (*(.gnu.linkonce.d.*personality*))
    143     SORT(CONSTRUCTORS)
    144   }
    145   .data1          : { *(.data1) }
    146   _edata = .; PROVIDE (edata = .);
    147   __bss_start = .;
    148   __bss_start__ = .;
    149   .bss            :
    150   {
    151    *(.dynbss)
    152    *(.bss .bss.* .gnu.linkonce.b.*)
    153    *(COMMON)
    154    /* Align here to ensure that the .bss section occupies space up to
    155       _end.  Align after .bss to ensure correct alignment even if the
    156       .bss section disappears because there are no input sections.
    157       FIXME: Why do we need it? When there is no .bss section, we don't
    158       pad the .data section.  */
    159    . = ALIGN(. != 0 ? 32 / 8 : 1);
    160   }
    161   _bss_end__ = . ; __bss_end__ = . ;
    162   . = ALIGN(32 / 8);
    163   . = ALIGN(32 / 8);
    164   __end__ = . ;
    165   _end = .; PROVIDE (end = .);
    166   /* Stabs debugging sections.  */
    167   .stab          0 : { *(.stab) }
    168   .stabstr       0 : { *(.stabstr) }
    169   .stab.excl     0 : { *(.stab.excl) }
    170   .stab.exclstr  0 : { *(.stab.exclstr) }
    171   .stab.index    0 : { *(.stab.index) }
    172   .stab.indexstr 0 : { *(.stab.indexstr) }
    173   .comment       0 : { *(.comment) }
    174   /* DWARF debug sections.
    175      Symbols in the DWARF debugging sections are relative to the beginning
    176      of the section so we begin them at 0.  */
    177   /* DWARF 1 */
    178   .debug          0 : { *(.debug) }
    179   .line           0 : { *(.line) }
    180   /* GNU DWARF 1 extensions */
    181   .debug_srcinfo  0 : { *(.debug_srcinfo) }
    182   .debug_sfnames  0 : { *(.debug_sfnames) }
    183   /* DWARF 1.1 and DWARF 2 */
    184   .debug_aranges  0 : { *(.debug_aranges) }
    185   .debug_pubnames 0 : { *(.debug_pubnames) }
    186   /* DWARF 2 */
    187   .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
    188   .debug_abbrev   0 : { *(.debug_abbrev) }
    189   .debug_line     0 : { *(.debug_line) }
    190   .debug_frame    0 : { *(.debug_frame) }
    191   .debug_str      0 : { *(.debug_str) }
    192   .debug_loc      0 : { *(.debug_loc) }
    193   .debug_macinfo  0 : { *(.debug_macinfo) }
    194   /* SGI/MIPS DWARF 2 extensions */
    195   .debug_weaknames 0 : { *(.debug_weaknames) }
    196   .debug_funcnames 0 : { *(.debug_funcnames) }
    197   .debug_typenames 0 : { *(.debug_typenames) }
    198   .debug_varnames  0 : { *(.debug_varnames) }
    199     .stack         0x80000 :
    200   {
    201     _stack = .;
    202     *(.stack)
    203   }
    204   .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
    205   .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) }
    206   /DISCARD/ : { *(.note.GNU-stack) }
    207 }
    208