Home | History | Annotate | Download | only in core
      1 /* Default linker script, for normal executables */
      2 OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm",
      3 	      "elf32-littlearm")
      4 OUTPUT_ARCH(arm)
      5 ENTRY(_start)
      6 SEARCH_DIR("/usr/local/armdev/arm-elf/lib");
      7 /* Do we need any of these for elf?
      8    __DYNAMIC = 0;    */
      9 SECTIONS
     10 {
     11   /* Read-only sections, merged into text segment: */
     12 /*  PROVIDE (__executable_start = 0x8000); . = 0x8000; */
     13 . = 0x8000 + SIZEOF_HEADERS;
     14   .interp         : { *(.interp) }
     15   .hash           : { *(.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.init       : { *(.rel.init) }
     22   .rela.init      : { *(.rela.init) }
     23   .rel.text       : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
     24   .rela.text      : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
     25   .rel.fini       : { *(.rel.fini) }
     26   .rela.fini      : { *(.rela.fini) }
     27   .rel.rodata     : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
     28   .rela.rodata    : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
     29   .rel.data.rel.ro   : { *(.rel.data.rel.ro*) }
     30   .rela.data.rel.ro   : { *(.rel.data.rel.ro*) }
     31   .rel.data       : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
     32   .rela.data      : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
     33   .rel.tdata	  : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
     34   .rela.tdata	  : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
     35   .rel.tbss	  : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
     36   .rela.tbss	  : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
     37   .rel.ctors      : { *(.rel.ctors) }
     38   .rela.ctors     : { *(.rela.ctors) }
     39   .rel.dtors      : { *(.rel.dtors) }
     40   .rela.dtors     : { *(.rela.dtors) }
     41   .rel.got        : { *(.rel.got) }
     42   .rela.got       : { *(.rela.got) }
     43   .rel.bss        : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
     44   .rela.bss       : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
     45   .rel.plt        : { *(.rel.plt) }
     46   .rela.plt       : { *(.rela.plt) }
     47   .init           :
     48   {
     49     KEEP (*(.init))
     50   } =0
     51   .plt            : { *(.plt) }
     52   .text           :
     53   {
     54     *(.text .stub .text.* .gnu.linkonce.t.*)
     55     KEEP (*(.text.*personality*))
     56     /* .gnu.warning sections are handled specially by elf32.em.  */
     57     *(.gnu.warning)
     58     *(.glue_7t) *(.glue_7)
     59   } =0
     60   .fini           :
     61   {
     62     KEEP (*(.fini))
     63   } =0
     64   PROVIDE (__etext = .);
     65   PROVIDE (_etext = .);
     66   PROVIDE (etext = .);
     67   .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
     68   .rodata1        : { *(.rodata1) }
     69   /* We have to wrap extab and exidx sections with KEEP because we use
     70      --gc-sections. */
     71   .ARM.extab   : { KEEP (*(.ARM.extab* .gnu.linkonce.armextab.*)) }
     72    __exidx_start = .;
     73   .ARM.exidx   : { KEEP (*(.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 { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) }
     78   /* Adjust the address for the data segment.  We want to align at exactly
     79      a page boundary to make life easier for apriori. */
     80   . = ALIGN(4096);
     81   /* Exception handling  */
     82   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
     83   .gcc_except_table   : ONLY_IF_RW { KEEP (*(.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   /* Ensure the __preinit_array_start label is properly aligned.  We
     88      could instead move the label definition inside the section, but
     89      the linker would then create the section even if it turns out to
     90      be empty, which isn't pretty.  */
     91   . = ALIGN(32 / 8);
     92   PROVIDE (__preinit_array_start = .);
     93   .preinit_array     : { KEEP (*(.preinit_array)) }
     94   PROVIDE (__preinit_array_end = .);
     95   PROVIDE (__init_array_start = .);
     96   .init_array     : { KEEP (*(.init_array)) }
     97   PROVIDE (__init_array_end = .);
     98   PROVIDE (__fini_array_start = .);
     99   .fini_array     : { KEEP (*(.fini_array)) }
    100   PROVIDE (__fini_array_end = .);
    101   .ctors          :
    102   {
    103     /* gcc uses crtbegin.o to find the start of
    104        the constructors, so we make sure it is
    105        first.  Because this is a wildcard, it
    106        doesn't matter if the user does not
    107        actually link against crtbegin.o; the
    108        linker won't look for a file to match a
    109        wildcard.  The wildcard also means that it
    110        doesn't matter which directory crtbegin.o
    111        is in.  */
    112     KEEP (*crtbegin*.o(.ctors))
    113     /* We don't want to include the .ctor section from
    114        from the crtend.o file until after the sorted ctors.
    115        The .ctor section from the crtend file contains the
    116        end of ctors marker and it must be last */
    117     KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
    118     KEEP (*(SORT(.ctors.*)))
    119     KEEP (*(.ctors))
    120   }
    121   .dtors          :
    122   {
    123     KEEP (*crtbegin*.o(.dtors))
    124     KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
    125     KEEP (*(SORT(.dtors.*)))
    126     KEEP (*(.dtors))
    127   }
    128   .jcr            : { KEEP (*(.jcr)) }
    129   .data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro*) }
    130   .dynamic        : { *(.dynamic) }
    131   .got            : { *(.got.plt) *(.got) }
    132   .data           :
    133   {
    134     __data_start = . ;
    135     *(.data .data.* .gnu.linkonce.d.*)
    136     KEEP (*(.gnu.linkonce.d.*personality*))
    137     SORT(CONSTRUCTORS)
    138   }
    139   .data1          : { *(.data1) }
    140   _edata = .;
    141   PROVIDE (edata = .);
    142   __bss_start = .;
    143   __bss_start__ = .;
    144   .bss            :
    145   {
    146    *(.dynbss)
    147    *(.bss .bss.* .gnu.linkonce.b.*)
    148    *(COMMON)
    149    /* Align here to ensure that the .bss section occupies space up to
    150       _end.  Align after .bss to ensure correct alignment even if the
    151       .bss section disappears because there are no input sections.  */
    152    . = ALIGN(32 / 8);
    153   }
    154   . = ALIGN(32 / 8);
    155   _end = .;
    156   _bss_end__ = . ; __bss_end__ = . ; __end__ = . ;
    157   PROVIDE (end = .);
    158   /* Stabs debugging sections.  */
    159   .stab          0 : { *(.stab) }
    160   .stabstr       0 : { *(.stabstr) }
    161   .stab.excl     0 : { *(.stab.excl) }
    162   .stab.exclstr  0 : { *(.stab.exclstr) }
    163   .stab.index    0 : { *(.stab.index) }
    164   .stab.indexstr 0 : { *(.stab.indexstr) }
    165   .comment       0 : { *(.comment) }
    166   /* DWARF debug sections.
    167      Symbols in the DWARF debugging sections are relative to the beginning
    168      of the section so we begin them at 0.  */
    169   /* DWARF 1 */
    170   .debug          0 : { *(.debug) }
    171   .line           0 : { *(.line) }
    172   /* GNU DWARF 1 extensions */
    173   .debug_srcinfo  0 : { *(.debug_srcinfo) }
    174   .debug_sfnames  0 : { *(.debug_sfnames) }
    175   /* DWARF 1.1 and DWARF 2 */
    176   .debug_aranges  0 : { *(.debug_aranges) }
    177   .debug_pubnames 0 : { *(.debug_pubnames) }
    178   /* DWARF 2 */
    179   .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
    180   .debug_abbrev   0 : { *(.debug_abbrev) }
    181   .debug_line     0 : { *(.debug_line) }
    182   .debug_frame    0 : { *(.debug_frame) }
    183   .debug_str      0 : { *(.debug_str) }
    184   .debug_loc      0 : { *(.debug_loc) }
    185   .debug_macinfo  0 : { *(.debug_macinfo) }
    186   /* SGI/MIPS DWARF 2 extensions */
    187   .debug_weaknames 0 : { *(.debug_weaknames) }
    188   .debug_funcnames 0 : { *(.debug_funcnames) }
    189   .debug_typenames 0 : { *(.debug_typenames) }
    190   .debug_varnames  0 : { *(.debug_varnames) }
    191   /* Adding the word ABSOLUTE below, so that the _stack below won't float
    192      into a random section. If _stack is not absolutely with .stack section,
    193      we saw that sometimes _stack got inserted into the .debug_frame section
    194      because it's processed by the linker at that moment. As a result, _stack
    195      symbol will get wrongly moved and gelf_update_symshndx() will return
    196      invalid data. */
    197     .stack         0x80000 :
    198   {
    199     _stack = ABSOLUTE(.);
    200     *(.stack)
    201   }
    202   .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
    203   /DISCARD/ : { *(.note.GNU-stack) }
    204 }
    205