Statistics
| Branch: | Revision:

root / amd64.ld @ bc51c5c9

History | View | Annotate | Download (12.9 kB)

1
/* Default linker script, for normal executables */
2
OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
3
OUTPUT_ARCH(i386:x86-64)
4
ENTRY(_start)
5
SEARCH_DIR("/lib64"); SEARCH_DIR("/usr/lib64"); SEARCH_DIR("/usr/local/lib64");
6
SECTIONS
7
{
8
  /* Read-only sections, merged into text segment: */
9
  . = 0x60000000 + SIZEOF_HEADERS;
10
  .interp         : { *(.interp) }
11
  .hash           : { *(.hash) }
12
  .dynsym         : { *(.dynsym) }
13
  .dynstr         : { *(.dynstr) }
14
  .gnu.version    : { *(.gnu.version) }
15
  .gnu.version_d  : { *(.gnu.version_d) }
16
  .gnu.version_r  : { *(.gnu.version_r) }
17
  .rel.init       : { *(.rel.init) }
18
  .rela.init      : { *(.rela.init) }
19
  .rel.text       : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
20
  .rela.text      : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
21
  .rel.fini       : { *(.rel.fini) }
22
  .rela.fini      : { *(.rela.fini) }
23
  .rel.rodata     : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
24
  .rela.rodata    : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
25
  .rel.data       : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
26
  .rela.data      : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
27
  .rel.tdata	  : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
28
  .rela.tdata	  : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
29
  .rel.tbss	  : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
30
  .rela.tbss	  : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
31
  .rel.ctors      : { *(.rel.ctors) }
32
  .rela.ctors     : { *(.rela.ctors) }
33
  .rel.dtors      : { *(.rel.dtors) }
34
  .rela.dtors     : { *(.rela.dtors) }
35
  .rel.got        : { *(.rel.got) }
36
  .rela.got       : { *(.rela.got) }
37
  .rel.bss        : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
38
  .rela.bss       : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
39
  .rel.plt        : { *(.rel.plt) }
40
  .rela.plt       : { *(.rela.plt) }
41
  .init           :
42
  {
43
    KEEP (*(.init))
44
  } =0x90909090
45
  .plt            : { *(.plt) }
46
  .text           :
47
  {
48
    *(.text .stub .text.* .gnu.linkonce.t.*)
49
    /* .gnu.warning sections are handled specially by elf32.em.  */
50
    *(.gnu.warning)
51
  } =0x90909090
52
  .fini           :
53
  {
54
    KEEP (*(.fini))
55
  } =0x90909090
56
  PROVIDE (__etext = .);
57
  PROVIDE (_etext = .);
58
  PROVIDE (etext = .);
59
  .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
60
  .rodata1        : { *(.rodata1) }
61
  .eh_frame_hdr : { *(.eh_frame_hdr) }
62
  .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }
63
  .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table) }
64
  /* Adjust the address for the data segment.  We want to adjust up to
65
     the same address within the page on the next page up.  */
66
  . = ALIGN (0x100000) - ((0x100000 - .) & (0x100000 - 1)); . = DATA_SEGMENT_ALIGN (0x100000, 0x1000);
67
  /* Ensure the __preinit_array_start label is properly aligned.  We
68
     could instead move the label definition inside the section, but
69
     the linker would then create the section even if it turns out to
70
     be empty, which isn't pretty.  */
71
  . = ALIGN(64 / 8);
72
  PROVIDE (__preinit_array_start = .);
73
  .preinit_array     : { *(.preinit_array) }
74
  PROVIDE (__preinit_array_end = .);
75
  PROVIDE (__init_array_start = .);
76
  .init_array     : { *(.init_array) }
77
  PROVIDE (__init_array_end = .);
78
  PROVIDE (__fini_array_start = .);
79
  .fini_array     : { *(.fini_array) }
80
  PROVIDE (__fini_array_end = .);
81
  .data           :
82
  {
83
    *(.data .data.* .gnu.linkonce.d.*)
84
    SORT(CONSTRUCTORS)
85
  }
86
  .data1          : { *(.data1) }
87
  .tdata	  : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
88
  .tbss		  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
89
  .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
90
  .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table) }
91
  .dynamic        : { *(.dynamic) }
92
  .ctors          :
93
  {
94
    /* gcc uses crtbegin.o to find the start of
95
       the constructors, so we make sure it is
96
       first.  Because this is a wildcard, it
97
       doesn't matter if the user does not
98
       actually link against crtbegin.o; the
99
       linker won't look for a file to match a
100
       wildcard.  The wildcard also means that it
101
       doesn't matter which directory crtbegin.o
102
       is in.  */
103
    KEEP (*crtbegin.o(.ctors))
104
    /* We don't want to include the .ctor section from
105
       from the crtend.o file until after the sorted ctors.
106
       The .ctor section from the crtend file contains the
107
       end of ctors marker and it must be last */
108
    KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
109
    KEEP (*(SORT(.ctors.*)))
110
    KEEP (*(.ctors))
111
  }
112
  .dtors          :
113
  {
114
    KEEP (*crtbegin.o(.dtors))
115
    KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
116
    KEEP (*(SORT(.dtors.*)))
117
    KEEP (*(.dtors))
118
  }
119
  .jcr            : { KEEP (*(.jcr)) }
120
  .got            : { *(.got.plt) *(.got) }
121
  _edata = .;
122
  PROVIDE (edata = .);
123
  __bss_start = .;
124
  .bss            :
125
  {
126
   *(.dynbss)
127
   *(.bss .bss.* .gnu.linkonce.b.*)
128
   *(COMMON)
129
   /* Align here to ensure that the .bss section occupies space up to
130
      _end.  Align after .bss to ensure correct alignment even if the
131
      .bss section disappears because there are no input sections.  */
132
   . = ALIGN(64 / 8);
133
  }
134
  . = ALIGN(64 / 8);
135
  _end = .;
136
  PROVIDE (end = .);
137
  . = DATA_SEGMENT_END (.);
138
  /* Stabs debugging sections.  */
139
  .stab          0 : { *(.stab) }
140
  .stabstr       0 : { *(.stabstr) }
141
  .stab.excl     0 : { *(.stab.excl) }
142
  .stab.exclstr  0 : { *(.stab.exclstr) }
143
  .stab.index    0 : { *(.stab.index) }
144
  .stab.indexstr 0 : { *(.stab.indexstr) }
145
  .comment       0 : { *(.comment) }
146
  /* DWARF debug sections.
147
     Symbols in the DWARF debugging sections are relative to the beginning
148
     of the section so we begin them at 0.  */
149
  /* DWARF 1 */
150
  .debug          0 : { *(.debug) }
151
  .line           0 : { *(.line) }
152
  /* GNU DWARF 1 extensions */
153
  .debug_srcinfo  0 : { *(.debug_srcinfo) }
154
  .debug_sfnames  0 : { *(.debug_sfnames) }
155
  /* DWARF 1.1 and DWARF 2 */
156
  .debug_aranges  0 : { *(.debug_aranges) }
157
  .debug_pubnames 0 : { *(.debug_pubnames) }
158
  /* DWARF 2 */
159
  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
160
  .debug_abbrev   0 : { *(.debug_abbrev) }
161
  .debug_line     0 : { *(.debug_line) }
162
  .debug_frame    0 : { *(.debug_frame) }
163
  .debug_str      0 : { *(.debug_str) }
164
  .debug_loc      0 : { *(.debug_loc) }
165
  .debug_macinfo  0 : { *(.debug_macinfo) }
166
  /* SGI/MIPS DWARF 2 extensions */
167
  .debug_weaknames 0 : { *(.debug_weaknames) }
168
  .debug_funcnames 0 : { *(.debug_funcnames) }
169
  .debug_typenames 0 : { *(.debug_typenames) }
170
  .debug_varnames  0 : { *(.debug_varnames) }
171
}
172
/* Default linker script, for normal executables */
173
OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
174
OUTPUT_ARCH(i386:x86-64)
175
ENTRY(_start)
176
SEARCH_DIR("/lib64"); SEARCH_DIR("/usr/lib64"); SEARCH_DIR("/usr/local/lib64");
177
SECTIONS
178
{
179
  /* Read-only sections, merged into text segment: */
180
  . = 0x60000000 + SIZEOF_HEADERS;
181
  .interp         : { *(.interp) }
182
  .hash           : { *(.hash) }
183
  .dynsym         : { *(.dynsym) }
184
  .dynstr         : { *(.dynstr) }
185
  .gnu.version    : { *(.gnu.version) }
186
  .gnu.version_d  : { *(.gnu.version_d) }
187
  .gnu.version_r  : { *(.gnu.version_r) }
188
  .rel.init       : { *(.rel.init) }
189
  .rela.init      : { *(.rela.init) }
190
  .rel.text       : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
191
  .rela.text      : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
192
  .rel.fini       : { *(.rel.fini) }
193
  .rela.fini      : { *(.rela.fini) }
194
  .rel.rodata     : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
195
  .rela.rodata    : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
196
  .rel.data       : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
197
  .rela.data      : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
198
  .rel.tdata	  : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
199
  .rela.tdata	  : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
200
  .rel.tbss	  : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
201
  .rela.tbss	  : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
202
  .rel.ctors      : { *(.rel.ctors) }
203
  .rela.ctors     : { *(.rela.ctors) }
204
  .rel.dtors      : { *(.rel.dtors) }
205
  .rela.dtors     : { *(.rela.dtors) }
206
  .rel.got        : { *(.rel.got) }
207
  .rela.got       : { *(.rela.got) }
208
  .rel.bss        : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
209
  .rela.bss       : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
210
  .rel.plt        : { *(.rel.plt) }
211
  .rela.plt       : { *(.rela.plt) }
212
  .init           :
213
  {
214
    KEEP (*(.init))
215
  } =0x90909090
216
  .plt            : { *(.plt) }
217
  .text           :
218
  {
219
    *(.text .stub .text.* .gnu.linkonce.t.*)
220
    /* .gnu.warning sections are handled specially by elf32.em.  */
221
    *(.gnu.warning)
222
  } =0x90909090
223
  .fini           :
224
  {
225
    KEEP (*(.fini))
226
  } =0x90909090
227
  PROVIDE (__etext = .);
228
  PROVIDE (_etext = .);
229
  PROVIDE (etext = .);
230
  .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
231
  .rodata1        : { *(.rodata1) }
232
  .eh_frame_hdr : { *(.eh_frame_hdr) }
233
  .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }
234
  .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table) }
235
  /* Adjust the address for the data segment.  We want to adjust up to
236
     the same address within the page on the next page up.  */
237
  . = ALIGN (0x100000) - ((0x100000 - .) & (0x100000 - 1)); . = DATA_SEGMENT_ALIGN (0x100000, 0x1000);
238
  /* Ensure the __preinit_array_start label is properly aligned.  We
239
     could instead move the label definition inside the section, but
240
     the linker would then create the section even if it turns out to
241
     be empty, which isn't pretty.  */
242
  . = ALIGN(64 / 8);
243
  PROVIDE (__preinit_array_start = .);
244
  .preinit_array     : { *(.preinit_array) }
245
  PROVIDE (__preinit_array_end = .);
246
  PROVIDE (__init_array_start = .);
247
  .init_array     : { *(.init_array) }
248
  PROVIDE (__init_array_end = .);
249
  PROVIDE (__fini_array_start = .);
250
  .fini_array     : { *(.fini_array) }
251
  PROVIDE (__fini_array_end = .);
252
  .data           :
253
  {
254
    *(.data .data.* .gnu.linkonce.d.*)
255
    SORT(CONSTRUCTORS)
256
  }
257
  .data1          : { *(.data1) }
258
  .tdata	  : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
259
  .tbss		  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
260
  .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
261
  .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table) }
262
  .dynamic        : { *(.dynamic) }
263
  .ctors          :
264
  {
265
    /* gcc uses crtbegin.o to find the start of
266
       the constructors, so we make sure it is
267
       first.  Because this is a wildcard, it
268
       doesn't matter if the user does not
269
       actually link against crtbegin.o; the
270
       linker won't look for a file to match a
271
       wildcard.  The wildcard also means that it
272
       doesn't matter which directory crtbegin.o
273
       is in.  */
274
    KEEP (*crtbegin.o(.ctors))
275
    /* We don't want to include the .ctor section from
276
       from the crtend.o file until after the sorted ctors.
277
       The .ctor section from the crtend file contains the
278
       end of ctors marker and it must be last */
279
    KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
280
    KEEP (*(SORT(.ctors.*)))
281
    KEEP (*(.ctors))
282
  }
283
  .dtors          :
284
  {
285
    KEEP (*crtbegin.o(.dtors))
286
    KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
287
    KEEP (*(SORT(.dtors.*)))
288
    KEEP (*(.dtors))
289
  }
290
  .jcr            : { KEEP (*(.jcr)) }
291
  .got            : { *(.got.plt) *(.got) }
292
  _edata = .;
293
  PROVIDE (edata = .);
294
  __bss_start = .;
295
  .bss            :
296
  {
297
   *(.dynbss)
298
   *(.bss .bss.* .gnu.linkonce.b.*)
299
   *(COMMON)
300
   /* Align here to ensure that the .bss section occupies space up to
301
      _end.  Align after .bss to ensure correct alignment even if the
302
      .bss section disappears because there are no input sections.  */
303
   . = ALIGN(64 / 8);
304
  }
305
  . = ALIGN(64 / 8);
306
  _end = .;
307
  PROVIDE (end = .);
308
  . = DATA_SEGMENT_END (.);
309
  /* Stabs debugging sections.  */
310
  .stab          0 : { *(.stab) }
311
  .stabstr       0 : { *(.stabstr) }
312
  .stab.excl     0 : { *(.stab.excl) }
313
  .stab.exclstr  0 : { *(.stab.exclstr) }
314
  .stab.index    0 : { *(.stab.index) }
315
  .stab.indexstr 0 : { *(.stab.indexstr) }
316
  .comment       0 : { *(.comment) }
317
  /* DWARF debug sections.
318
     Symbols in the DWARF debugging sections are relative to the beginning
319
     of the section so we begin them at 0.  */
320
  /* DWARF 1 */
321
  .debug          0 : { *(.debug) }
322
  .line           0 : { *(.line) }
323
  /* GNU DWARF 1 extensions */
324
  .debug_srcinfo  0 : { *(.debug_srcinfo) }
325
  .debug_sfnames  0 : { *(.debug_sfnames) }
326
  /* DWARF 1.1 and DWARF 2 */
327
  .debug_aranges  0 : { *(.debug_aranges) }
328
  .debug_pubnames 0 : { *(.debug_pubnames) }
329
  /* DWARF 2 */
330
  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
331
  .debug_abbrev   0 : { *(.debug_abbrev) }
332
  .debug_line     0 : { *(.debug_line) }
333
  .debug_frame    0 : { *(.debug_frame) }
334
  .debug_str      0 : { *(.debug_str) }
335
  .debug_loc      0 : { *(.debug_loc) }
336
  .debug_macinfo  0 : { *(.debug_macinfo) }
337
  /* SGI/MIPS DWARF 2 extensions */
338
  .debug_weaknames 0 : { *(.debug_weaknames) }
339
  .debug_funcnames 0 : { *(.debug_funcnames) }
340
  .debug_typenames 0 : { *(.debug_typenames) }
341
  .debug_varnames  0 : { *(.debug_varnames) }
342
}