Home | History | Annotate | Download | only in ldscripts
      1 /* Script for -n: mix text and data on same page */
      2 /* Copyright (C) 2014 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(pei-x86-64)
      7 SECTIONS
      8 {
      9   /* Make the virtual address and file offset synced if the alignment is
     10      lower than the target page size. */
     11   . = SIZEOF_HEADERS;
     12   . = ALIGN(__section_alignment__);
     13   .text  __image_base__ + ( __section_alignment__ < 0x1000 ? . : __section_alignment__ ) :
     14   {
     15      *(.init)
     16     *(.text)
     17     *(SORT(.text$*))
     18      *(.text.*)
     19      *(.gnu.linkonce.t.*)
     20     *(.glue_7t)
     21     *(.glue_7)
     22     . = ALIGN(8);
     23      ___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
     24 			LONG (-1); LONG (-1);*(.ctors); *(.ctor); *(SORT(.ctors.*));  LONG (0); LONG (0);
     25      ___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
     26 			LONG (-1); LONG (-1); *(.dtors); *(.dtor); *(SORT(.dtors.*));  LONG (0); LONG (0);
     27      *(.fini)
     28     /* ??? Why is .gcc_exc here?  */
     29      *(.gcc_exc)
     30     PROVIDE (etext = .);
     31      *(.gcc_except_table)
     32   }
     33   /* The Cygwin32 library uses a section to avoid copying certain data
     34      on fork.  This used to be named ".data".  The linker used
     35      to include this between __data_start__ and __data_end__, but that
     36      breaks building the cygwin32 dll.  Instead, we name the section
     37      ".data_cygwin_nocopy" and explicitly include it after __data_end__. */
     38   .data BLOCK(__section_alignment__) :
     39   {
     40     __data_start__ = . ;
     41     *(.data)
     42     *(.data2)
     43     *(SORT(.data$*))
     44     *(.jcr)
     45     __data_end__ = . ;
     46     *(.data_cygwin_nocopy)
     47   }
     48   .rdata BLOCK(__section_alignment__) :
     49   {
     50     *(.rdata)
     51              *(SORT(.rdata$*))
     52     __rt_psrelocs_start = .;
     53     *(.rdata_runtime_pseudo_reloc)
     54     __rt_psrelocs_end = .;
     55   }
     56   __rt_psrelocs_size = __rt_psrelocs_end - __rt_psrelocs_start;
     57   ___RUNTIME_PSEUDO_RELOC_LIST_END__ = .;
     58   __RUNTIME_PSEUDO_RELOC_LIST_END__ = .;
     59   ___RUNTIME_PSEUDO_RELOC_LIST__ = . - __rt_psrelocs_size;
     60   __RUNTIME_PSEUDO_RELOC_LIST__ = . - __rt_psrelocs_size;
     61   .eh_frame BLOCK(__section_alignment__) :
     62   {
     63     *(.eh_frame*)
     64   }
     65   .pdata BLOCK(__section_alignment__) :
     66   {
     67     *(.pdata*)
     68   }
     69   .xdata BLOCK(__section_alignment__) :
     70   {
     71     *(.xdata*)
     72   }
     73   .bss BLOCK(__section_alignment__) :
     74   {
     75     __bss_start__ = . ;
     76     *(.bss)
     77     *(COMMON)
     78     __bss_end__ = . ;
     79   }
     80   .edata BLOCK(__section_alignment__) :
     81   {
     82     *(.edata)
     83   }
     84   /DISCARD/ :
     85   {
     86     *(.debug$S)
     87     *(.debug$T)
     88     *(.debug$F)
     89     *(.drectve)
     90      *(.note.GNU-stack)
     91      *(.gnu.lto_*)
     92   }
     93   .idata BLOCK(__section_alignment__) :
     94   {
     95     /* This cannot currently be handled with grouped sections.
     96 	See pep.em:sort_sections.  */
     97     SORT(*)(.idata$2)
     98     SORT(*)(.idata$3)
     99     /* These zeroes mark the end of the import list.  */
    100     LONG (0); LONG (0); LONG (0); LONG (0); LONG (0);
    101     SORT(*)(.idata$4)
    102     __IAT_start__ = .;
    103     SORT(*)(.idata$5)
    104     __IAT_end__ = .;
    105     SORT(*)(.idata$6)
    106     SORT(*)(.idata$7)
    107   }
    108   .CRT BLOCK(__section_alignment__) :
    109   {
    110     ___crt_xc_start__ = . ;
    111     *(SORT(.CRT$XC*))  /* C initialization */
    112     ___crt_xc_end__ = . ;
    113     ___crt_xi_start__ = . ;
    114     *(SORT(.CRT$XI*))  /* C++ initialization */
    115     ___crt_xi_end__ = . ;
    116     ___crt_xl_start__ = . ;
    117     *(SORT(.CRT$XL*))  /* TLS callbacks */
    118     /* ___crt_xl_end__ is defined in the TLS Directory support code */
    119     ___crt_xp_start__ = . ;
    120     *(SORT(.CRT$XP*))  /* Pre-termination */
    121     ___crt_xp_end__ = . ;
    122     ___crt_xt_start__ = . ;
    123     *(SORT(.CRT$XT*))  /* Termination */
    124     ___crt_xt_end__ = . ;
    125   }
    126   /* Windows TLS expects .tls$AAA to be at the start and .tls$ZZZ to be
    127      at the end of the .tls section.  This is important because _tls_start MUST
    128      be at the beginning of the section to enable SECREL32 relocations with TLS
    129      data.  */
    130   .tls BLOCK(__section_alignment__) :
    131   {
    132     ___tls_start__ = . ;
    133     *(.tls$AAA)
    134     *(.tls)
    135     *(.tls$)
    136     *(SORT(.tls$*))
    137     *(.tls$ZZZ)
    138     ___tls_end__ = . ;
    139   }
    140   .endjunk BLOCK(__section_alignment__) :
    141   {
    142     /* end is deprecated, don't use it */
    143     PROVIDE (end = .);
    144     PROVIDE ( _end = .);
    145      __end__ = .;
    146   }
    147   .rsrc BLOCK(__section_alignment__) : SUBALIGN(4)
    148   {
    149     *(.rsrc)
    150     *(.rsrc$*)
    151   }
    152   .reloc BLOCK(__section_alignment__) :
    153   {
    154     *(.reloc)
    155   }
    156   .stab BLOCK(__section_alignment__) (NOLOAD) :
    157   {
    158     *(.stab)
    159   }
    160   .stabstr BLOCK(__section_alignment__) (NOLOAD) :
    161   {
    162     *(.stabstr)
    163   }
    164   /* DWARF debug sections.
    165      Symbols in the DWARF debugging sections are relative to the beginning
    166      of the section.  Unlike other targets that fake this by putting the
    167      section VMA at 0, the PE format will not allow it.  */
    168   /* DWARF 1.1 and DWARF 2.  */
    169   .debug_aranges BLOCK(__section_alignment__) (NOLOAD) :
    170   {
    171     *(.debug_aranges)
    172   }
    173   .zdebug_aranges BLOCK(__section_alignment__) (NOLOAD) :
    174   {
    175     *(.zdebug_aranges)
    176   }
    177   .debug_pubnames BLOCK(__section_alignment__) (NOLOAD) :
    178   {
    179     *(.debug_pubnames)
    180   }
    181   .zdebug_pubnames BLOCK(__section_alignment__) (NOLOAD) :
    182   {
    183     *(.zdebug_pubnames)
    184   }
    185   .debug_pubtypes BLOCK(__section_alignment__) (NOLOAD) :
    186   {
    187     *(.debug_pubtypes)
    188   }
    189   .zdebug_pubtypes BLOCK(__section_alignment__) (NOLOAD) :
    190   {
    191     *(.zdebug_pubtypes)
    192   }
    193   /* DWARF 2.  */
    194   .debug_info BLOCK(__section_alignment__) (NOLOAD) :
    195   {
    196     *(.debug_info .gnu.linkonce.wi.*)
    197   }
    198   .zdebug_info BLOCK(__section_alignment__) (NOLOAD) :
    199   {
    200     *(.zdebug_info .zdebug.gnu.linkonce.wi.*)
    201   }
    202   .debug_abbrev BLOCK(__section_alignment__) (NOLOAD) :
    203   {
    204     *(.debug_abbrev)
    205   }
    206   .zdebug_abbrev BLOCK(__section_alignment__) (NOLOAD) :
    207   {
    208     *(.zdebug_abbrev)
    209   }
    210   .debug_line BLOCK(__section_alignment__) (NOLOAD) :
    211   {
    212     *(.debug_line)
    213   }
    214   .zdebug_line BLOCK(__section_alignment__) (NOLOAD) :
    215   {
    216     *(.zdebug_line)
    217   }
    218   .debug_frame BLOCK(__section_alignment__) (NOLOAD) :
    219   {
    220     *(.debug_frame)
    221   }
    222   .zdebug_frame BLOCK(__section_alignment__) (NOLOAD) :
    223   {
    224     *(.zdebug_frame)
    225   }
    226   .debug_str BLOCK(__section_alignment__) (NOLOAD) :
    227   {
    228     *(.debug_str)
    229   }
    230   .zdebug_str BLOCK(__section_alignment__) (NOLOAD) :
    231   {
    232     *(.zdebug_str)
    233   }
    234   .debug_loc BLOCK(__section_alignment__) (NOLOAD) :
    235   {
    236     *(.debug_loc)
    237   }
    238   .zdebug_loc BLOCK(__section_alignment__) (NOLOAD) :
    239   {
    240     *(.zdebug_loc)
    241   }
    242   .debug_macinfo BLOCK(__section_alignment__) (NOLOAD) :
    243   {
    244     *(.debug_macinfo)
    245   }
    246   .zdebug_macinfo BLOCK(__section_alignment__) (NOLOAD) :
    247   {
    248     *(.zdebug_macinfo)
    249   }
    250   /* SGI/MIPS DWARF 2 extensions.  */
    251   .debug_weaknames BLOCK(__section_alignment__) (NOLOAD) :
    252   {
    253     *(.debug_weaknames)
    254   }
    255   .zdebug_weaknames BLOCK(__section_alignment__) (NOLOAD) :
    256   {
    257     *(.zdebug_weaknames)
    258   }
    259   .debug_funcnames BLOCK(__section_alignment__) (NOLOAD) :
    260   {
    261     *(.debug_funcnames)
    262   }
    263   .zdebug_funcnames BLOCK(__section_alignment__) (NOLOAD) :
    264   {
    265     *(.zdebug_funcnames)
    266   }
    267   .debug_typenames BLOCK(__section_alignment__) (NOLOAD) :
    268   {
    269     *(.debug_typenames)
    270   }
    271   .zdebug_typenames BLOCK(__section_alignment__) (NOLOAD) :
    272   {
    273     *(.zdebug_typenames)
    274   }
    275   .debug_varnames BLOCK(__section_alignment__) (NOLOAD) :
    276   {
    277     *(.debug_varnames)
    278   }
    279   .zdebug_varnames BLOCK(__section_alignment__) (NOLOAD) :
    280   {
    281     *(.zdebug_varnames)
    282   }
    283   .debug_macro BLOCK(__section_alignment__) (NOLOAD) :
    284   {
    285     *(.debug_macro)
    286   }
    287   .zdebug_macro BLOCK(__section_alignment__) (NOLOAD) :
    288   {
    289     *(.zdebug_macro)
    290   }
    291   /* DWARF 3.  */
    292   .debug_ranges BLOCK(__section_alignment__) (NOLOAD) :
    293   {
    294     *(.debug_ranges)
    295   }
    296   .zdebug_ranges BLOCK(__section_alignment__) (NOLOAD) :
    297   {
    298     *(.zdebug_ranges)
    299   }
    300   /* DWARF 4.  */
    301   .debug_types BLOCK(__section_alignment__) (NOLOAD) :
    302   {
    303     *(.debug_types .gnu.linkonce.wt.*)
    304   }
    305   .zdebug_types BLOCK(__section_alignment__) (NOLOAD) :
    306   {
    307     *(.zdebug_types .zdebug.gnu.linkonce.wt.*)
    308   }
    309 }
    310