]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - ld/scripttempl/pe.sc
* scripttempl/pe.sc: Add zeroes after .idata$3 to mark the end of
[thirdparty/binutils-gdb.git] / ld / scripttempl / pe.sc
1 # Linker script for PE.
2
3 cat <<EOF
4 OUTPUT_FORMAT(${OUTPUT_FORMAT})
5 ${LIB_SEARCH_DIRS}
6
7 ENTRY(_mainCRTStartup)
8
9 SECTIONS
10 {
11 .text ${RELOCATING+ __image_base__ + __section_alignment__ } :
12 {
13 ${RELOCATING+ *(.init)}
14 *(.text)
15 ${CONSTRUCTING+ ___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
16 LONG (-1); *(.ctors); *(.ctor); LONG (0); }
17 ${CONSTRUCTING+ ___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
18 LONG (-1); *(.dtors); *(.dtor); LONG (0); }
19 ${RELOCATING+ *(.fini)}
20 /* ??? Why is .gcc_exc here? */
21 ${RELOCATING+ *(.gcc_exc)}
22 ${RELOCATING+ etext = .;}
23 /* Grouped section support currently must be explicitly provided for
24 in the linker script. */
25 *(.text\$)
26 *(.gcc_except_table)
27 }
28
29 .bss BLOCK(__section_alignment__) :
30 {
31 __bss_start__ = . ;
32 *(.bss)
33 *(COMMON)
34 __bss_end__ = . ;
35 }
36 .data BLOCK(__section_alignment__) :
37 {
38 __data_start__ = . ;
39 *(.data)
40 *(.data2)
41 __data_end__ = . ;
42 /* Grouped section support currently must be explicitly provided for
43 in the linker script. */
44 *(.data\$)
45 }
46
47 .rdata BLOCK(__section_alignment__) :
48 {
49 *(.rdata)
50 /* Grouped section support currently must be explicitly provided for
51 in the linker script. */
52 *(.rdata\$)
53 }
54
55 .edata BLOCK(__section_alignment__) :
56 {
57 *(.edata)
58 }
59
60 /DISCARD/ BLOCK(__section_alignment__) :
61 {
62 *(.debug\$S)
63 *(.debug\$T)
64 *(.debug\$F)
65 *(.drectve)
66 }
67
68 .idata BLOCK(__section_alignment__) :
69 {
70 /* This cannot currently be handled with grouped sections.
71 See pe.em:sort_sections. */
72 *(.idata\$2)
73 *(.idata\$3)
74 ${RELOCATING+ /* These zeroes mark the end of the import list. */}
75 ${RELOCATING+ LONG (0); LONG (0); LONG (0); LONG (0); LONG (0);}
76 *(.idata\$4)
77 *(.idata\$5)
78 *(.idata\$6)
79 *(.idata\$7)
80 }
81 .CRT BLOCK(__section_alignment__) :
82 {
83 /* Grouped sections are used to handle .CRT\$foo. */
84 *(.CRT\$)
85 }
86 .rsrc BLOCK(__section_alignment__) :
87 {
88 /* Grouped sections are used to handle .rsrc\$0[12]. */
89 *(.rsrc\$)
90 }
91
92 .endjunk BLOCK(__section_alignment__) :
93 {
94 /* end is deprecated, don't use it */
95 ${RELOCATING+ end = .;}
96 ${RELOCATING+ __end__ = .;}
97 }
98
99 .stab BLOCK(__section_alignment__) ${RELOCATING+(NOLOAD)} :
100 {
101 [ .stab ]
102 }
103
104 .stabstr BLOCK(__section_alignment__) ${RELOCATING+(NOLOAD)} :
105 {
106 [ .stabstr ]
107 }
108
109 .reloc BLOCK(__section_alignment__) :
110 {
111 *(.reloc)
112 }
113 }
114 EOF