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