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 | # Sorting of the .foo$* sections is required by the definition of
|
---|
10 | # grouped sections in PE.
|
---|
11 | # Sorting of the file names in R_IDATA is required by the
|
---|
12 | # current implementation of dlltool (this could probably be changed to
|
---|
13 | # use grouped sections instead).
|
---|
14 | if test "${RELOCATING}"; then
|
---|
15 | R_TEXT='*(SORT(.text$*))'
|
---|
16 | R_DATA='*(SORT(.data$*))'
|
---|
17 | R_RDATA='*(SORT(.rdata$*))'
|
---|
18 | R_IDATA='
|
---|
19 | SORT(*)(.idata$2)
|
---|
20 | SORT(*)(.idata$3)
|
---|
21 | /* These zeroes mark the end of the import list. */
|
---|
22 | LONG (0); LONG (0); LONG (0); LONG (0); LONG (0);
|
---|
23 | SORT(*)(.idata$4)
|
---|
24 | SORT(*)(.idata$5)
|
---|
25 | SORT(*)(.idata$6)
|
---|
26 | SORT(*)(.idata$7)'
|
---|
27 | R_CRT='*(SORT(.CRT$*))'
|
---|
28 | R_RSRC='*(SORT(.rsrc$*))'
|
---|
29 | else
|
---|
30 | R_TEXT=
|
---|
31 | R_DATA=
|
---|
32 | R_RDATA=
|
---|
33 | R_IDATA=
|
---|
34 | R_CRT=
|
---|
35 | R_RSRC=
|
---|
36 | fi
|
---|
37 |
|
---|
38 | cat <<EOF
|
---|
39 | ${RELOCATING+OUTPUT_FORMAT(${OUTPUT_FORMAT})}
|
---|
40 | ${RELOCATING-OUTPUT_FORMAT(${RELOCATEABLE_OUTPUT_FORMAT})}
|
---|
41 |
|
---|
42 | ${LIB_SEARCH_DIRS}
|
---|
43 |
|
---|
44 | ENTRY(_mainCRTStartup)
|
---|
45 |
|
---|
46 | SECTIONS
|
---|
47 | {
|
---|
48 | .text ${RELOCATING+ __image_base__ + __section_alignment__ } :
|
---|
49 | {
|
---|
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 | *(.gcc_except_table)
|
---|
64 |
|
---|
65 | /* For EPOC the read only data is located at the end of the .text
|
---|
66 | section */
|
---|
67 | *(.rdata)
|
---|
68 | ${R_RDATA}
|
---|
69 | *(.eh_frame)
|
---|
70 | }
|
---|
71 |
|
---|
72 | /* The Cygwin32 library uses a section to avoid copying certain data
|
---|
73 | on fork. This used to be named ".data$nocopy". The linker used
|
---|
74 | to include this between __data_start__ and __data_end__, but that
|
---|
75 | breaks building the cygwin32 dll. Instead, we name the section
|
---|
76 | ".data_cygwin_nocopy" and explictly include it after __data_end__. */
|
---|
77 |
|
---|
78 | .data ${RELOCATING+BLOCK(__section_alignment__)} :
|
---|
79 | {
|
---|
80 | ${RELOCATING+__data_start__ = . ;}
|
---|
81 | *(.data)
|
---|
82 | *(.data2)
|
---|
83 | ${R_DATA}
|
---|
84 | ${RELOCATING+__data_end__ = . ;}
|
---|
85 | ${RELOCATING+*(.data_cygwin_nocopy)}
|
---|
86 | }
|
---|
87 |
|
---|
88 | .bss ${RELOCATING+BLOCK(__section_alignment__)} :
|
---|
89 | {
|
---|
90 | ${RELOCATING+__bss_start__ = . ;}
|
---|
91 | *(.bss)
|
---|
92 | *(COMMON)
|
---|
93 | ${RELOCATING+__bss_end__ = . ;}
|
---|
94 | }
|
---|
95 |
|
---|
96 | .edata ${RELOCATING+BLOCK(__section_alignment__)} :
|
---|
97 | {
|
---|
98 | *(.edata)
|
---|
99 | }
|
---|
100 |
|
---|
101 | /DISCARD/ :
|
---|
102 | {
|
---|
103 | *(.debug\$S)
|
---|
104 | *(.debug\$T)
|
---|
105 | *(.debug\$F)
|
---|
106 | *(.drectve)
|
---|
107 | }
|
---|
108 |
|
---|
109 | .idata ${RELOCATING+BLOCK(__section_alignment__)} :
|
---|
110 | {
|
---|
111 | /* This cannot currently be handled with grouped sections.
|
---|
112 | See pe.em:sort_sections. */
|
---|
113 | ${R_IDATA}
|
---|
114 | }
|
---|
115 |
|
---|
116 | .CRT ${RELOCATING+BLOCK(__section_alignment__)} :
|
---|
117 | {
|
---|
118 | ${R_CRT}
|
---|
119 | }
|
---|
120 |
|
---|
121 | .endjunk ${RELOCATING+BLOCK(__section_alignment__)} :
|
---|
122 | {
|
---|
123 | /* end is deprecated, don't use it */
|
---|
124 | ${RELOCATING+ end = .;}
|
---|
125 | ${RELOCATING+ _end = .;}
|
---|
126 | ${RELOCATING+ __end__ = .;}
|
---|
127 | }
|
---|
128 |
|
---|
129 | .reloc ${RELOCATING+BLOCK(__section_alignment__)} :
|
---|
130 | {
|
---|
131 | *(.reloc)
|
---|
132 | }
|
---|
133 |
|
---|
134 | .rsrc ${RELOCATING+BLOCK(__section_alignment__)} :
|
---|
135 | {
|
---|
136 | *(.rsrc)
|
---|
137 | ${R_RSRC}
|
---|
138 | }
|
---|
139 |
|
---|
140 | .stab ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
|
---|
141 | {
|
---|
142 | [ .stab ]
|
---|
143 | }
|
---|
144 |
|
---|
145 | .stabstr ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
|
---|
146 | {
|
---|
147 | [ .stabstr ]
|
---|
148 | }
|
---|
149 |
|
---|
150 | }
|
---|
151 | EOF
|
---|