Statistics
| Branch: | Revision:

root / x86_64.ld @ 4bf6b55b

History | View | Annotate | Download (6.4 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
SECTIONS
6
{
7
  /* Read-only sections, merged into text segment: */
8
  . = 0x60000000 + SIZEOF_HEADERS;
9
  .interp         : { *(.interp) }
10
  .hash           : { *(.hash) }
11
  .dynsym         : { *(.dynsym) }
12
  .dynstr         : { *(.dynstr) }
13
  .gnu.version    : { *(.gnu.version) }
14
  .gnu.version_d  : { *(.gnu.version_d) }
15
  .gnu.version_r  : { *(.gnu.version_r) }
16
  .rel.init       : { *(.rel.init) }
17
  .rela.init      : { *(.rela.init) }
18
  .rel.text       : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
19
  .rela.text      : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
20
  .rel.fini       : { *(.rel.fini) }
21
  .rela.fini      : { *(.rela.fini) }
22
  .rel.rodata     : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
23
  .rela.rodata    : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
24
  .rel.data       : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
25
  .rela.data      : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
26
  .rel.tdata	  : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
27
  .rela.tdata	  : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
28
  .rel.tbss	  : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
29
  .rela.tbss	  : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
30
  .rel.ctors      : { *(.rel.ctors) }
31
  .rela.ctors     : { *(.rela.ctors) }
32
  .rel.dtors      : { *(.rel.dtors) }
33
  .rela.dtors     : { *(.rela.dtors) }
34
  .rel.got        : { *(.rel.got) }
35
  .rela.got       : { *(.rela.got) }
36
  .rel.bss        : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
37
  .rela.bss       : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
38
  .rel.plt        : { *(.rel.plt) }
39
  .rela.plt       : { *(.rela.plt) }
40
  .init           :
41
  {
42
    KEEP (*(.init))
43
  } =0x90909090
44
  .plt            : { *(.plt) }
45
  .text           :
46
  {
47
    *(.text .stub .text.* .gnu.linkonce.t.*)
48
    /* .gnu.warning sections are handled specially by elf32.em.  */
49
    *(.gnu.warning)
50
  } =0x90909090
51
  .fini           :
52
  {
53
    KEEP (*(.fini))
54
  } =0x90909090
55
  PROVIDE (__etext = .);
56
  PROVIDE (_etext = .);
57
  PROVIDE (etext = .);
58
  .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
59
  .rodata1        : { *(.rodata1) }
60
  .eh_frame_hdr : { *(.eh_frame_hdr) }
61
  .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }
62
  .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table) }
63
  /* Adjust the address for the data segment.  We want to adjust up to
64
     the same address within the page on the next page up.  */
65
  . = ALIGN (0x100000) - ((0x100000 - .) & (0x100000 - 1)); . = DATA_SEGMENT_ALIGN (0x100000, 0x1000);
66
  /* Ensure the __preinit_array_start label is properly aligned.  We
67
     could instead move the label definition inside the section, but
68
     the linker would then create the section even if it turns out to
69
     be empty, which isn't pretty.  */
70
  . = ALIGN(64 / 8);
71
  PROVIDE (__preinit_array_start = .);
72
  .preinit_array     : { *(.preinit_array) }
73
  PROVIDE (__preinit_array_end = .);
74
  PROVIDE (__init_array_start = .);
75
  .init_array     : { *(.init_array) }
76
  PROVIDE (__init_array_end = .);
77
  PROVIDE (__fini_array_start = .);
78
  .fini_array     : { *(.fini_array) }
79
  PROVIDE (__fini_array_end = .);
80
  .data           :
81
  {
82
    *(.data .data.* .gnu.linkonce.d.*)
83
    SORT(CONSTRUCTORS)
84
  }
85
  .data1          : { *(.data1) }
86
  .tdata	  : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
87
  .tbss		  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
88
  .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
89
  .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table) }
90
  .dynamic        : { *(.dynamic) }
91
  .ctors          :
92
  {
93
    /* gcc uses crtbegin.o to find the start of
94
       the constructors, so we make sure it is
95
       first.  Because this is a wildcard, it
96
       doesn't matter if the user does not
97
       actually link against crtbegin.o; the
98
       linker won't look for a file to match a
99
       wildcard.  The wildcard also means that it
100
       doesn't matter which directory crtbegin.o
101
       is in.  */
102
    KEEP (*crtbegin.o(.ctors))
103
    /* We don't want to include the .ctor section from
104
       from the crtend.o file until after the sorted ctors.
105
       The .ctor section from the crtend file contains the
106
       end of ctors marker and it must be last */
107
    KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
108
    KEEP (*(SORT(.ctors.*)))
109
    KEEP (*(.ctors))
110
  }
111
  .dtors          :
112
  {
113
    KEEP (*crtbegin.o(.dtors))
114
    KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
115
    KEEP (*(SORT(.dtors.*)))
116
    KEEP (*(.dtors))
117
  }
118
  .jcr            : { KEEP (*(.jcr)) }
119
  .got            : { *(.got.plt) *(.got) }
120
  _edata = .;
121
  PROVIDE (edata = .);
122
  __bss_start = .;
123
  .bss            :
124
  {
125
   *(.dynbss)
126
   *(.bss .bss.* .gnu.linkonce.b.*)
127
   *(COMMON)
128
   /* Align here to ensure that the .bss section occupies space up to
129
      _end.  Align after .bss to ensure correct alignment even if the
130
      .bss section disappears because there are no input sections.  */
131
   . = ALIGN(64 / 8);
132
  }
133
  . = ALIGN(64 / 8);
134
  _end = .;
135
  PROVIDE (end = .);
136
  . = DATA_SEGMENT_END (.);
137
  /* Stabs debugging sections.  */
138
  .stab          0 : { *(.stab) }
139
  .stabstr       0 : { *(.stabstr) }
140
  .stab.excl     0 : { *(.stab.excl) }
141
  .stab.exclstr  0 : { *(.stab.exclstr) }
142
  .stab.index    0 : { *(.stab.index) }
143
  .stab.indexstr 0 : { *(.stab.indexstr) }
144
  .comment       0 : { *(.comment) }
145
  /* DWARF debug sections.
146
     Symbols in the DWARF debugging sections are relative to the beginning
147
     of the section so we begin them at 0.  */
148
  /* DWARF 1 */
149
  .debug          0 : { *(.debug) }
150
  .line           0 : { *(.line) }
151
  /* GNU DWARF 1 extensions */
152
  .debug_srcinfo  0 : { *(.debug_srcinfo) }
153
  .debug_sfnames  0 : { *(.debug_sfnames) }
154
  /* DWARF 1.1 and DWARF 2 */
155
  .debug_aranges  0 : { *(.debug_aranges) }
156
  .debug_pubnames 0 : { *(.debug_pubnames) }
157
  /* DWARF 2 */
158
  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
159
  .debug_abbrev   0 : { *(.debug_abbrev) }
160
  .debug_line     0 : { *(.debug_line) }
161
  .debug_frame    0 : { *(.debug_frame) }
162
  .debug_str      0 : { *(.debug_str) }
163
  .debug_loc      0 : { *(.debug_loc) }
164
  .debug_macinfo  0 : { *(.debug_macinfo) }
165
  /* SGI/MIPS DWARF 2 extensions */
166
  .debug_weaknames 0 : { *(.debug_weaknames) }
167
  .debug_funcnames 0 : { *(.debug_funcnames) }
168
  .debug_typenames 0 : { *(.debug_typenames) }
169
  .debug_varnames  0 : { *(.debug_varnames) }
170
}