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