Home | History | Annotate | Download | only in ldscripts
      1 /* Script for -z combreloc -z now -z relro: combine and sort reloc sections */
      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   PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x400000)); . = SEGMENT_START("text-segment", 0x400000) + 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.plt) *(.igot.plt) *(.got) *(.igot) }
    134   . = DATA_SEGMENT_RELRO_END (0, .);
    135   .data           :
    136   {
    137     *(.data .data.* .gnu.linkonce.d.*)
    138     SORT(CONSTRUCTORS)
    139   }
    140   .data1          : { *(.data1) }
    141   _edata = .; PROVIDE (edata = .);
    142   __bss_start = .;
    143   .bss            :
    144   {
    145    *(.dynbss)
    146    *(.bss .bss.* .gnu.linkonce.b.*)
    147    *(COMMON)
    148    /* Align here to ensure that the .bss section occupies space up to
    149       _end.  Align after .bss to ensure correct alignment even if the
    150       .bss section disappears because there are no input sections.
    151       FIXME: Why do we need it? When there is no .bss section, we don't
    152       pad the .data section.  */
    153    . = ALIGN(. != 0 ? 64 / 8 : 1);
    154   }
    155   .lbss   :
    156   {
    157     *(.dynlbss)
    158     *(.lbss .lbss.* .gnu.linkonce.lb.*)
    159     *(LARGE_COMMON)
    160   }
    161   . = ALIGN(64 / 8);
    162   .lrodata   ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)) :
    163   {
    164     *(.lrodata .lrodata.* .gnu.linkonce.lr.*)
    165   }
    166   .ldata   ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)) :
    167   {
    168     *(.ldata .ldata.* .gnu.linkonce.l.*)
    169     . = ALIGN(. != 0 ? 64 / 8 : 1);
    170   }
    171   . = ALIGN(64 / 8);
    172   _end = .; PROVIDE (end = .);
    173   . = DATA_SEGMENT_END (.);
    174   /* Stabs debugging sections.  */
    175   .stab          0 : { *(.stab) }
    176   .stabstr       0 : { *(.stabstr) }
    177   .stab.excl     0 : { *(.stab.excl) }
    178   .stab.exclstr  0 : { *(.stab.exclstr) }
    179   .stab.index    0 : { *(.stab.index) }
    180   .stab.indexstr 0 : { *(.stab.indexstr) }
    181   .comment       0 : { *(.comment) }
    182   /* DWARF debug sections.
    183      Symbols in the DWARF debugging sections are relative to the beginning
    184      of the section so we begin them at 0.  */
    185   /* DWARF 1 */
    186   .debug          0 : { *(.debug) }
    187   .line           0 : { *(.line) }
    188   /* GNU DWARF 1 extensions */
    189   .debug_srcinfo  0 : { *(.debug_srcinfo .zdebug_srcinfo) }
    190   .debug_sfnames  0 : { *(.debug_sfnames .zdebug_sfnames) }
    191   /* DWARF 1.1 and DWARF 2 */
    192   .debug_aranges  0 : { *(.debug_aranges .zdebug_aranges) }
    193   .debug_pubnames 0 : { *(.debug_pubnames .zdebug_pubnames) }
    194   /* DWARF 2 */
    195   .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.* .zdebug_info) }
    196   .debug_abbrev   0 : { *(.debug_abbrev .zdebug_abbrev) }
    197   .debug_line     0 : { *(.debug_line .zdebug_line) }
    198   .debug_frame    0 : { *(.debug_frame .zdebug_frame) }
    199   .debug_str      0 : { *(.debug_str .zdebug_str) }
    200   .debug_loc      0 : { *(.debug_loc .zdebug_loc) }
    201   .debug_macinfo  0 : { *(.debug_macinfo .zdebug_macinfo) }
    202   /* SGI/MIPS DWARF 2 extensions */
    203   .debug_weaknames 0 : { *(.debug_weaknames .zdebug_weaknames) }
    204   .debug_funcnames 0 : { *(.debug_funcnames .zdebug_funcnames) }
    205   .debug_typenames 0 : { *(.debug_typenames .zdebug_typenames) }
    206   .debug_varnames  0 : { *(.debug_varnames .zdebug_varnames) }
    207   /* DWARF 3 */
    208   .debug_pubtypes 0 : { *(.debug_pubtypes .zdebug_pubtypes) }
    209   .debug_ranges   0 : { *(.debug_ranges .zdebug_ranges) }
    210   .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
    211   /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
    212 }
    213