Commit | Line | Data |
---|---|---|
252b5132 RH |
1 | # Linker script for PE. |
2 | ||
3 | if test -z "${RELOCATEABLE_OUTPUT_FORMAT}"; then | |
4 | RELOCATEABLE_OUTPUT_FORMAT=${OUTPUT_FORMAT} | |
5 | fi | |
6 | ||
7 | # We can't easily and portably get an unquoted $ in a shell | |
8 | # substitution, so we do this instead. | |
9 | if test "${RELOCATING}"; then | |
10 | R_TEXT='*(.text$*)' | |
11 | R_DATA='*(.data$*)' | |
12 | R_RDATA='*(.rdata$*)' | |
13 | R_IDATA=' | |
14 | *(.idata$2) | |
15 | *(.idata$3) | |
16 | /* These zeroes mark the end of the import list. */ | |
17 | LONG (0); LONG (0); LONG (0); LONG (0); LONG (0); | |
18 | *(.idata$4) | |
19 | *(.idata$5) | |
20 | *(.idata$6) | |
21 | *(.idata$7)' | |
22 | R_CRT='*(.CRT$*)' | |
23 | R_RSRC='*(.rsrc$*)' | |
24 | R_EXC='*(.exc$*)' | |
25 | else | |
26 | R_TEXT= | |
27 | R_DATA= | |
28 | R_RDATA= | |
29 | R_IDATA= | |
30 | R_CRT= | |
31 | R_RSRC= | |
32 | R_EXC= | |
33 | fi | |
34 | ||
35 | cat <<EOF | |
36 | ${RELOCATING+OUTPUT_FORMAT(${OUTPUT_FORMAT})} | |
37 | ${RELOCATING-OUTPUT_FORMAT(${RELOCATEABLE_OUTPUT_FORMAT})} | |
38 | ||
39 | ${LIB_SEARCH_DIRS} | |
40 | ||
41 | ENTRY(__start) | |
42 | ${RELOCATING+header = .;} | |
43 | ${RELOCATING+__fltused = .; /* set up floating pt for MS .obj\'s */} | |
44 | ${RELOCATING+__ldused = .;} | |
45 | SECTIONS | |
46 | { | |
47 | .text ${RELOCATING+ __image_base__ + __section_alignment__ } : | |
48 | { | |
49 | ${RELOCATING+ __text_start__ = . ;} | |
50 | ${RELOCATING+ *(.init)} | |
51 | *(.text) | |
52 | ${R_TEXT} | |
53 | *(.glue_7t) | |
54 | *(.glue_7) | |
55 | ${CONSTRUCTING+ ___CTOR_LIST__ = .; __CTOR_LIST__ = . ; | |
56 | LONG (-1); *(.ctors); *(.ctor); LONG (0); } | |
57 | ${CONSTRUCTING+ ___DTOR_LIST__ = .; __DTOR_LIST__ = . ; | |
58 | LONG (-1); *(.dtors); *(.dtor); LONG (0); } | |
59 | ${RELOCATING+ *(.fini)} | |
60 | /* ??? Why is .gcc_exc here? */ | |
61 | ${RELOCATING+ *(.gcc_exc)} | |
62 | ${RELOCATING+ etext = .;} | |
63 | ${RELOCATING+ __text_end__ = .;} | |
64 | *(.gcc_except_table) | |
65 | } | |
66 | ||
67 | /* The Cygwin32 library uses a section to avoid copying certain data | |
68 | on fork. This used to be named ".data$nocopy". The linker used | |
69 | to include this between __data_start__ and __data_end__, but that | |
70 | breaks building the cygwin32 dll. Instead, we name the section | |
71 | ".data_cygwin_nocopy" and explictly include it after __data_end__. */ | |
72 | ||
73 | .data ${RELOCATING+BLOCK(__section_alignment__)} : | |
74 | { | |
75 | ${RELOCATING+__data_start__ = . ;} | |
76 | *(.data) | |
77 | *(.data2) | |
78 | ${R_DATA} | |
79 | ${RELOCATING+__data_end__ = . ;} | |
80 | ${RELOCATING+*(.data_cygwin_nocopy)} | |
81 | } | |
82 | ||
83 | .bss ${RELOCATING+BLOCK(__section_alignment__)} : | |
84 | { | |
85 | ${RELOCATING+__bss_start__ = . ;} | |
86 | *(.bss) | |
87 | *(COMMON) | |
88 | /* link.exe apparently pulls in .obj's because of UNDEF common | |
89 | symbols, which is not the coff way, but that's MS for you. */ | |
90 | *(.CRT\$XCA) | |
91 | *(.CRT\$XCZ) | |
92 | *(.CRT\$XIA) | |
93 | *(.CRT\$XIZ) | |
94 | ${RELOCATING+__bss_end__ = . ;} | |
95 | } | |
96 | ||
97 | .rdata ${RELOCATING+BLOCK(__section_alignment__)} : | |
98 | { | |
99 | *(.rdata) | |
100 | ${R_RDATA} | |
101 | *(.eh_frame) | |
102 | } | |
103 | ||
104 | .edata ${RELOCATING+BLOCK(__section_alignment__)} : | |
105 | { | |
106 | *(.edata) | |
107 | } | |
108 | ||
109 | /DISCARD/ : | |
110 | { | |
111 | *(.debug\$S) | |
112 | *(.debug\$T) | |
113 | *(.debug\$F) | |
114 | *(.drectve) | |
115 | *(.debug*) | |
116 | } | |
117 | ||
118 | .idata ${RELOCATING+BLOCK(__section_alignment__)} : | |
119 | { | |
120 | /* This cannot currently be handled with grouped sections. | |
121 | See pe.em:sort_sections. */ | |
122 | ${R_IDATA} | |
123 | } | |
124 | .CRT ${RELOCATING+BLOCK(__section_alignment__)} : | |
125 | { | |
126 | ${R_CRT} | |
127 | } | |
128 | ||
129 | .endjunk ${RELOCATING+BLOCK(__section_alignment__)} : | |
130 | { | |
131 | /* end is deprecated, don't use it */ | |
132 | ${RELOCATING+ end = .;} | |
133 | ${RELOCATING+ _end = .;} | |
134 | ${RELOCATING+ __end__ = .;} | |
135 | } | |
136 | ||
137 | .reloc ${RELOCATING+BLOCK(__section_alignment__)} : | |
138 | { | |
139 | *(.reloc) | |
140 | } | |
141 | ||
142 | .rsrc ${RELOCATING+BLOCK(__section_alignment__)} : | |
143 | { | |
144 | *(.rsrc) | |
145 | ${R_RSRC} | |
146 | } | |
147 | ||
148 | .exc ${RELOCATING+BLOCK(__section_alignment__)} : | |
149 | { | |
150 | *(.exc) | |
151 | ${R_EXC} | |
152 | } | |
153 | ||
154 | .stab ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} : | |
155 | { | |
156 | [ .stab ] | |
157 | } | |
158 | ||
159 | .stabstr ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} : | |
160 | { | |
161 | [ .stabstr ] | |
162 | } | |
163 | /* DWARF debug sections. | |
164 | Symbols in the DWARF debugging sections are relative to the beginning | |
165 | of the section so we begin them at 0. */ | |
166 | ||
167 | /* DWARF 1 */ | |
168 | .debug 0 ${RELOCATING+(NOLOAD)} : { *(.debug) } | |
169 | .line 0 ${RELOCATING+(NOLOAD)} : { *(.line) } | |
170 | ||
171 | /* GNU DWARF 1 extensions */ | |
172 | .debug_srcinfo 0 ${RELOCATING+(NOLOAD)} : { *(.debug_srcinfo) } | |
173 | .debug_sfnames 0 ${RELOCATING+(NOLOAD)} : { *(.debug_sfnames) } | |
174 | ||
175 | /* DWARF 1.1 and DWARF 2 */ | |
176 | .debug_aranges 0 ${RELOCATING+(NOLOAD)} : { *(.debug_aranges) } | |
177 | .debug_pubnames 0 ${RELOCATING+(NOLOAD)} : { *(.debug_pubnames) } | |
178 | ||
179 | /* DWARF 2 */ | |
3a9d486c | 180 | .debug_info 0 ${RELOCATING+(NOLOAD)} : { *(.debug_info) *(.gnu.linkonce.wi.*) } |
252b5132 RH |
181 | .debug_abbrev 0 ${RELOCATING+(NOLOAD)} : { *(.debug_abbrev) } |
182 | .debug_line 0 ${RELOCATING+(NOLOAD)} : { *(.debug_line) } | |
183 | .debug_frame 0 ${RELOCATING+(NOLOAD)} : { *(.debug_frame) } | |
184 | .debug_str 0 ${RELOCATING+(NOLOAD)} : { *(.debug_str) } | |
185 | .debug_loc 0 ${RELOCATING+(NOLOAD)} : { *(.debug_loc) } | |
186 | .debug_macinfo 0 ${RELOCATING+(NOLOAD)} : { *(.debug_macinfo) } | |
187 | ||
188 | /* SGI/MIPS DWARF 2 extensions */ | |
189 | .debug_weaknames 0 ${RELOCATING+(NOLOAD)} : { *(.debug_weaknames) } | |
190 | .debug_funcnames 0 ${RELOCATING+(NOLOAD)} : { *(.debug_funcnames) } | |
191 | .debug_typenames 0 ${RELOCATING+(NOLOAD)} : { *(.debug_typenames) } | |
192 | .debug_varnames 0 ${RELOCATING+(NOLOAD)} : { *(.debug_varnames) } | |
193 | } | |
194 | EOF |