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