Home | History | Annotate | Download | only in ldscripts
      1 /* Script for ld -Ur: link w/out relocation, do create constructors */
      2 /* Copyright (C) 2014-2016 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-x86-64", "elf32-x86-64",
      7 	      "elf32-x86-64")
      8 OUTPUT_ARCH(i386:x64-32)
      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.ldata   0 : { *(.rela.ldata) }
     38   .rela.lbss    0 : { *(.rela.lbss) }
     39   .rela.lrodata 0 : { *(.rela.lrodata) }
     40   .rela.ifunc   0 : { *(.rela.ifunc) }
     41   .rela.plt     0 :
     42     {
     43       *(.rela.plt)
     44     }
     45   .init         0 :
     46   {
     47     KEEP (*(SORT_NONE(.init)))
     48   }
     49   .plt          0 : { *(.plt) *(.iplt) }
     50   .text         0 :
     51   {
     52     *(.text .stub)
     53     /* .gnu.warning sections are handled specially by elf32.em.  */
     54     *(.gnu.warning)
     55   }
     56   .fini         0 :
     57   {
     58     KEEP (*(SORT_NONE(.fini)))
     59   }
     60   .rodata       0 : { *(.rodata) }
     61   .rodata1      0 : { *(.rodata1) }
     62   .eh_frame_hdr : { *(.eh_frame_hdr)  }
     63   .eh_frame     0 : ONLY_IF_RO { KEEP (*(.eh_frame))  }
     64   .gcc_except_table 0 : ONLY_IF_RO { *(.gcc_except_table
     65   .gcc_except_table.*) }
     66   .gnu_extab 0 : ONLY_IF_RO { *(.gnu_extab*) }
     67   /* These sections are generated by the Sun/Oracle C++ compiler.  */
     68   .exception_ranges 0 : ONLY_IF_RO { *(.exception_ranges
     69   .exception_ranges*) }
     70   /* Adjust the address for the data segment.  We want to adjust up to
     71      the same address within the page on the next page up.  */
     72   /* Exception handling  */
     73   .eh_frame     0 : ONLY_IF_RW { KEEP (*(.eh_frame))  }
     74   .gnu_extab    0 : ONLY_IF_RW { *(.gnu_extab) }
     75   .gcc_except_table 0 : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
     76   .exception_ranges 0 : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) }
     77   /* Thread Local Storage sections  */
     78   .tdata	0 : { *(.tdata) }
     79   .tbss		0 : { *(.tbss) }
     80   .preinit_array   0 :
     81   {
     82     KEEP (*(.preinit_array))
     83   }
     84   .jcr          0 : { KEEP (*(.jcr)) }
     85   .dynamic      0 : { *(.dynamic) }
     86   .got          0 : { *(.got) *(.igot) }
     87   .got.plt      0 : { *(.got.plt)  *(.igot.plt) }
     88   .data         0 :
     89   {
     90     *(.data)
     91     SORT(CONSTRUCTORS)
     92   }
     93   .data1        0 : { *(.data1) }
     94   .bss          0 :
     95   {
     96    *(.dynbss)
     97    *(.bss)
     98    *(COMMON)
     99    /* Align here to ensure that the .bss section occupies space up to
    100       _end.  Align after .bss to ensure correct alignment even if the
    101       .bss section disappears because there are no input sections.
    102       FIXME: Why do we need it? When there is no .bss section, we don't
    103       pad the .data section.  */
    104   }
    105   .lbss 0 :
    106   {
    107     *(.dynlbss)
    108     *(.lbss)
    109     *(LARGE_COMMON)
    110   }
    111   .lrodata 0  :
    112   {
    113     *(.lrodata)
    114   }
    115   .ldata 0  :
    116   {
    117     *(.ldata)
    118   }
    119   /* Stabs debugging sections.  */
    120   .stab          0 : { *(.stab) }
    121   .stabstr       0 : { *(.stabstr) }
    122   .stab.excl     0 : { *(.stab.excl) }
    123   .stab.exclstr  0 : { *(.stab.exclstr) }
    124   .stab.index    0 : { *(.stab.index) }
    125   .stab.indexstr 0 : { *(.stab.indexstr) }
    126   .comment       0 : { *(.comment) }
    127   /* DWARF debug sections.
    128      Symbols in the DWARF debugging sections are relative to the beginning
    129      of the section so we begin them at 0.  */
    130   /* DWARF 1 */
    131   .debug          0 : { *(.debug) }
    132   .line           0 : { *(.line) }
    133   /* GNU DWARF 1 extensions */
    134   .debug_srcinfo  0 : { *(.debug_srcinfo) }
    135   .debug_sfnames  0 : { *(.debug_sfnames) }
    136   /* DWARF 1.1 and DWARF 2 */
    137   .debug_aranges  0 : { *(.debug_aranges) }
    138   .debug_pubnames 0 : { *(.debug_pubnames) }
    139   /* DWARF 2 */
    140   .debug_info     0 : { *(.debug_info) }
    141   .debug_abbrev   0 : { *(.debug_abbrev) }
    142   .debug_line     0 : { *(.debug_line .debug_line.* .debug_line_end ) }
    143   .debug_frame    0 : { *(.debug_frame) }
    144   .debug_str      0 : { *(.debug_str) }
    145   .debug_loc      0 : { *(.debug_loc) }
    146   .debug_macinfo  0 : { *(.debug_macinfo) }
    147   /* SGI/MIPS DWARF 2 extensions */
    148   .debug_weaknames 0 : { *(.debug_weaknames) }
    149   .debug_funcnames 0 : { *(.debug_funcnames) }
    150   .debug_typenames 0 : { *(.debug_typenames) }
    151   .debug_varnames  0 : { *(.debug_varnames) }
    152   /* DWARF 3 */
    153   .debug_pubtypes 0 : { *(.debug_pubtypes) }
    154   .debug_ranges   0 : { *(.debug_ranges) }
    155   /* DWARF Extension.  */
    156   .debug_macro    0 : { *(.debug_macro) }
    157   .debug_addr     0 : { *(.debug_addr) }
    158   .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
    159 }
    160