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