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 | ||
596d6d91 | 41 | ${RELOCATING+ENTRY (__start)} |
252b5132 RH |
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 | |
cc643b88 | 71 | ".data_cygwin_nocopy" and explicitly include it after __data_end__. */ |
252b5132 RH |
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 | } | |
ceb0a680 NC |
163 | EOF |
164 | ||
d061dfac | 165 | . $srcdir/scripttempl/DWARF.sc |
ceb0a680 NC |
166 | |
167 | cat <<EOF | |
252b5132 RH |
168 | } |
169 | EOF |