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