Home | History | Annotate | Download | only in ldscripts
      1 /* Script for ld -Ur: link w/out relocation, do create constructors */
      2 /* Copyright (C) 2014 Free Software Foundation, Inc.
      3    Copying and distribution of this script, with or without modification,
      4    are permitted in any medium without royalty provided the copyright
      5    notice and this notice are preserved.  */
      6 OUTPUT_FORMAT("elf32-bigaarch64", "elf32-bigaarch64",
      7 	      "elf32-littleaarch64")
      8 OUTPUT_ARCH(aarch64:ilp32)
      9  /* For some reason, the Solaris linker makes bad executables
     10   if gld -r is used and the intermediate file has sections starting
     11   at non-zero addresses.  Could be a Solaris ld bug, could be a GNU ld
     12   bug.  But for now assigning the zero vmas works.  */
     13 SECTIONS
     14 {
     15   /* Read-only sections, merged into text segment: */
     16   .interp       0 : { *(.interp) }
     17   .note.gnu.build-id : { *(.note.gnu.build-id) }
     18   .hash         0 : { *(.hash) }
     19   .gnu.hash     0 : { *(.gnu.hash) }
     20   .dynsym       0 : { *(.dynsym) }
     21   .dynstr       0 : { *(.dynstr) }
     22   .gnu.version  0 : { *(.gnu.version) }
     23   .gnu.version_d 0: { *(.gnu.version_d) }
     24   .gnu.version_r 0: { *(.gnu.version_r) }
     25   .rela.init    0 : { *(.rela.init) }
     26   .rela.text    0 : { *(.rela.text) }
     27   .rela.fini    0 : { *(.rela.fini) }
     28   .rela.rodata  0 : { *(.rela.rodata) }
     29   .rela.data.rel.ro 0 : { *(.rela.data.rel.ro) }
     30   .rela.data    0 : { *(.rela.data) }
     31   .rela.tdata	0 : { *(.rela.tdata) }
     32   .rela.tbss	0 : { *(.rela.tbss) }
     33   .rela.ctors   0 : { *(.rela.ctors) }
     34   .rela.dtors   0 : { *(.rela.dtors) }
     35   .rela.got     0 : { *(.rela.got) }
     36   .rela.bss     0 : { *(.rela.bss) }
     37   .rela.ifunc   0 : { *(.rela.ifunc) }
     38   .rela.plt     0 :
     39     {
     40       *(.rela.plt)
     41     }
     42   .init         0 :
     43   {
     44     KEEP (*(SORT_NONE(.init)))
     45   } =0
     46   .plt          0 : { *(.plt) *(.iplt) }
     47   .text         0 :
     48   {
     49     *(.text .stub)
     50     /* .gnu.warning sections are handled specially by elf32.em.  */
     51     *(.gnu.warning)
     52   } =0
     53   .fini         0 :
     54   {
     55     KEEP (*(SORT_NONE(.fini)))
     56   } =0
     57   .rodata       0 : { *(.rodata) }
     58   .rodata1      0 : { *(.rodata1) }
     59   .eh_frame_hdr : { *(.eh_frame_hdr) }
     60   .eh_frame     0 : ONLY_IF_RO { KEEP (*(.eh_frame)) }
     61   .gcc_except_table 0 : ONLY_IF_RO { *(.gcc_except_table
     62   .gcc_except_table.*) }
     63   /* These sections are generated by the Sun/Oracle C++ compiler.  */
     64   .exception_ranges 0 : ONLY_IF_RO { *(.exception_ranges
     65   .exception_ranges*) }
     66   /* Adjust the address for the data segment.  For 32 bits we want to align
     67   at exactly a page boundary to make life easier for apriori. */
     68   /* Exception handling  */
     69   .eh_frame     0 : ONLY_IF_RW { KEEP (*(.eh_frame)) }
     70   .gcc_except_table 0 : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
     71   .exception_ranges 0 : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) }
     72   /* Thread Local Storage sections  */
     73   .tdata	0 : { *(.tdata) }
     74   .tbss		0 : { *(.tbss) }
     75   /* Ensure the __preinit_array_start label is properly aligned.  We
     76      could instead move the label definition inside the section, but
     77      the linker would then create the section even if it turns out to
     78      be empty, which isn't pretty.  */
     79   .preinit_array   0 :
     80   {
     81     KEEP (*(.preinit_array))
     82   }
     83   .jcr          0 : { KEEP (*(.jcr)) }
     84   .dynamic      0 : { *(.dynamic) }
     85   .got          0 : { *(.got) *(.igot) }
     86   .got.plt      0 : { *(.got.plt)  *(.igot.plt) }
     87   .data         0 :
     88   {
     89     *(.data)
     90     SORT(CONSTRUCTORS)
     91   }
     92   .data1        0 : { *(.data1) }
     93   .bss          0 :
     94   {
     95    *(.dynbss)
     96    *(.bss)
     97    *(COMMON)
     98    /* Align here to ensure that the .bss section occupies space up to
     99       _end.  Align after .bss to ensure correct alignment even if the
    100       .bss section disappears because there are no input sections.  */
    101   }
    102   /* Stabs debugging sections.  */
    103   .stab          0 : { *(.stab) }
    104   .stabstr       0 : { *(.stabstr) }
    105   .stab.excl     0 : { *(.stab.excl) }
    106   .stab.exclstr  0 : { *(.stab.exclstr) }
    107   .stab.index    0 : { *(.stab.index) }
    108   .stab.indexstr 0 : { *(.stab.indexstr) }
    109   .comment       0 : { *(.comment) }
    110   /* DWARF debug sections.
    111      Symbols in the DWARF debugging sections are relative to the beginning
    112      of the section so we begin them at 0.  */
    113   /* DWARF 1 */
    114   .debug          0 : { *(.debug) }
    115   .line           0 : { *(.line) }
    116   /* GNU DWARF 1 extensions */
    117   .debug_srcinfo  0 : { *(.debug_srcinfo) }
    118   .debug_sfnames  0 : { *(.debug_sfnames) }
    119   /* DWARF 1.1 and DWARF 2 */
    120   .debug_aranges  0 : { *(.debug_aranges) }
    121   .debug_pubnames 0 : { *(.debug_pubnames) }
    122   /* DWARF 2 */
    123   .debug_info     0 : { *(.debug_info) }
    124   .debug_abbrev   0 : { *(.debug_abbrev) }
    125   .debug_line     0 : { *(.debug_line .debug_line.* .debug_line_end ) }
    126   .debug_frame    0 : { *(.debug_frame) }
    127   .debug_str      0 : { *(.debug_str) }
    128   .debug_loc      0 : { *(.debug_loc) }
    129   .debug_macinfo  0 : { *(.debug_macinfo) }
    130   /* SGI/MIPS DWARF 2 extensions */
    131   .debug_weaknames 0 : { *(.debug_weaknames) }
    132   .debug_funcnames 0 : { *(.debug_funcnames) }
    133   .debug_typenames 0 : { *(.debug_typenames) }
    134   .debug_varnames  0 : { *(.debug_varnames) }
    135   /* DWARF 3 */
    136   .debug_pubtypes 0 : { *(.debug_pubtypes) }
    137   .debug_ranges   0 : { *(.debug_ranges) }
    138   /* DWARF Extension.  */
    139   .debug_macro    0 : { *(.debug_macro) }
    140     .stack        0 :
    141   {
    142     *(.stack)
    143   }
    144   .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP (*(.gnu.attributes)) }
    145   .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
    146 }
    147