Statistics
| Branch: | Revision:

root / mips.ld @ f58ae59c

History | View | Annotate | Download (8.4 kB)

1 608e8ce2 ths
/* Default linker script, for normal executables */
2 608e8ce2 ths
OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips",
3 608e8ce2 ths
             "elf32-tradlittlemips")
4 608e8ce2 ths
OUTPUT_ARCH(mips)
5 608e8ce2 ths
ENTRY(__start)
6 608e8ce2 ths
SECTIONS
7 608e8ce2 ths
{
8 608e8ce2 ths
  /* Read-only sections, merged into text segment: */
9 608e8ce2 ths
  PROVIDE (__executable_start = 0x0400000); . = 0x0400000 + SIZEOF_HEADERS;
10 608e8ce2 ths
  .interp         : { *(.interp) }
11 608e8ce2 ths
  .reginfo        : { *(.reginfo) }
12 608e8ce2 ths
  .dynamic        : { *(.dynamic) }
13 608e8ce2 ths
  .hash           : { *(.hash) }
14 608e8ce2 ths
  .dynsym         : { *(.dynsym) }
15 608e8ce2 ths
  .dynstr         : { *(.dynstr) }
16 608e8ce2 ths
  .gnu.version    : { *(.gnu.version) }
17 608e8ce2 ths
  .gnu.version_d  : { *(.gnu.version_d) }
18 608e8ce2 ths
  .gnu.version_r  : { *(.gnu.version_r) }
19 608e8ce2 ths
  .rel.init       : { *(.rel.init) }
20 608e8ce2 ths
  .rela.init      : { *(.rela.init) }
21 608e8ce2 ths
  .rel.text       : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
22 608e8ce2 ths
  .rela.text      : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
23 608e8ce2 ths
  .rel.fini       : { *(.rel.fini) }
24 608e8ce2 ths
  .rela.fini      : { *(.rela.fini) }
25 608e8ce2 ths
  .rel.rodata     : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
26 608e8ce2 ths
  .rela.rodata    : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
27 608e8ce2 ths
  .rel.data.rel.ro   : { *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) }
28 608e8ce2 ths
  .rela.data.rel.ro   : { *(.rela.data.rel.ro* .rela.gnu.linkonce.d.rel.ro.*) }
29 608e8ce2 ths
  .rel.data       : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
30 608e8ce2 ths
  .rela.data      : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
31 608e8ce2 ths
  .rel.tdata     : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
32 608e8ce2 ths
  .rela.tdata    : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
33 608e8ce2 ths
  .rel.tbss      : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
34 608e8ce2 ths
  .rela.tbss     : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
35 608e8ce2 ths
  .rel.ctors      : { *(.rel.ctors) }
36 608e8ce2 ths
  .rela.ctors     : { *(.rela.ctors) }
37 608e8ce2 ths
  .rel.dtors      : { *(.rel.dtors) }
38 608e8ce2 ths
  .rela.dtors     : { *(.rela.dtors) }
39 608e8ce2 ths
  .rel.got        : { *(.rel.got) }
40 608e8ce2 ths
  .rela.got       : { *(.rela.got) }
41 608e8ce2 ths
  .rel.sdata      : { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) }
42 608e8ce2 ths
  .rela.sdata     : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) }
43 608e8ce2 ths
  .rel.sbss       : { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) }
44 608e8ce2 ths
  .rela.sbss      : { *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) }
45 608e8ce2 ths
  .rel.sdata2     : { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) }
46 608e8ce2 ths
  .rela.sdata2    : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) }
47 608e8ce2 ths
  .rel.sbss2      : { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) }
48 608e8ce2 ths
  .rela.sbss2     : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) }
49 608e8ce2 ths
  .rel.bss        : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
50 608e8ce2 ths
  .rela.bss       : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
51 608e8ce2 ths
  .rel.plt        : { *(.rel.plt) }
52 608e8ce2 ths
  .rela.plt       : { *(.rela.plt) }
53 608e8ce2 ths
  .init           :
54 608e8ce2 ths
  {
55 608e8ce2 ths
    KEEP (*(.init))
56 608e8ce2 ths
  } =0x47ff041f
57 608e8ce2 ths
  .plt            : { *(.plt) }
58 608e8ce2 ths
  .text           :
59 608e8ce2 ths
  {
60 608e8ce2 ths
    _ftext = . ;
61 608e8ce2 ths
    *(.text .stub .text.* .gnu.linkonce.t.*)
62 608e8ce2 ths
    KEEP (*(.text.*personality*))
63 608e8ce2 ths
    /* .gnu.warning sections are handled specially by elf32.em.  */
64 608e8ce2 ths
    *(.gnu.warning)
65 608e8ce2 ths
    *(.mips16.fn.*) *(.mips16.call.*)
66 608e8ce2 ths
  } =0x47ff041f
67 608e8ce2 ths
  .fini           :
68 608e8ce2 ths
  {
69 608e8ce2 ths
    KEEP (*(.fini))
70 608e8ce2 ths
  } =0x47ff041f
71 608e8ce2 ths
  PROVIDE (__etext = .);
72 608e8ce2 ths
  PROVIDE (_etext = .);
73 608e8ce2 ths
  PROVIDE (etext = .);
74 608e8ce2 ths
  .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
75 608e8ce2 ths
  .rodata1        : { *(.rodata1) }
76 608e8ce2 ths
  .sdata2         :
77 608e8ce2 ths
  {
78 608e8ce2 ths
    *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
79 608e8ce2 ths
  }
80 608e8ce2 ths
  .sbss2          : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) }
81 608e8ce2 ths
  .eh_frame_hdr : { *(.eh_frame_hdr) }
82 608e8ce2 ths
  .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }
83 608e8ce2 ths
  .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
84 608e8ce2 ths
  /* Adjust the address for the data segment.  We want to adjust up to
85 608e8ce2 ths
     the same address within the page on the next page up.  */
86 608e8ce2 ths
  . = ALIGN (0x40000) - ((0x40000 - .) & (0x40000 - 1)); . = DATA_SEGMENT_ALIGN (0x40000, 0x1000);
87 608e8ce2 ths
  /* Exception handling  */
88 608e8ce2 ths
  .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
89 608e8ce2 ths
  .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
90 608e8ce2 ths
  /* Thread Local Storage sections  */
91 608e8ce2 ths
  .tdata         : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
92 608e8ce2 ths
  .tbss                  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
93 608e8ce2 ths
  .preinit_array     :
94 608e8ce2 ths
  {
95 608e8ce2 ths
    PROVIDE_HIDDEN (__preinit_array_start = .);
96 608e8ce2 ths
    KEEP (*(.preinit_array))
97 608e8ce2 ths
    PROVIDE_HIDDEN (__preinit_array_end = .);
98 608e8ce2 ths
  }
99 608e8ce2 ths
  .init_array     :
100 608e8ce2 ths
  {
101 608e8ce2 ths
     PROVIDE_HIDDEN (__init_array_start = .);
102 608e8ce2 ths
     KEEP (*(SORT(.init_array.*)))
103 608e8ce2 ths
     KEEP (*(.init_array))
104 608e8ce2 ths
     PROVIDE_HIDDEN (__init_array_end = .);
105 608e8ce2 ths
  }
106 608e8ce2 ths
  .fini_array     :
107 608e8ce2 ths
  {
108 608e8ce2 ths
    PROVIDE_HIDDEN (__fini_array_start = .);
109 608e8ce2 ths
    KEEP (*(.fini_array))
110 608e8ce2 ths
    KEEP (*(SORT(.fini_array.*)))
111 608e8ce2 ths
    PROVIDE_HIDDEN (__fini_array_end = .);
112 608e8ce2 ths
  }
113 608e8ce2 ths
  .ctors          :
114 608e8ce2 ths
  {
115 608e8ce2 ths
    /* gcc uses crtbegin.o to find the start of
116 608e8ce2 ths
       the constructors, so we make sure it is
117 608e8ce2 ths
       first.  Because this is a wildcard, it
118 608e8ce2 ths
       doesn't matter if the user does not
119 608e8ce2 ths
       actually link against crtbegin.o; the
120 608e8ce2 ths
       linker won't look for a file to match a
121 608e8ce2 ths
       wildcard.  The wildcard also means that it
122 608e8ce2 ths
       doesn't matter which directory crtbegin.o
123 608e8ce2 ths
       is in.  */
124 608e8ce2 ths
    KEEP (*crtbegin*.o(.ctors))
125 608e8ce2 ths
    /* We don't want to include the .ctor section from
126 608e8ce2 ths
       the crtend.o file until after the sorted ctors.
127 608e8ce2 ths
       The .ctor section from the crtend file contains the
128 608e8ce2 ths
       end of ctors marker and it must be last */
129 608e8ce2 ths
    KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
130 608e8ce2 ths
    KEEP (*(SORT(.ctors.*)))
131 608e8ce2 ths
    KEEP (*(.ctors))
132 608e8ce2 ths
  }
133 608e8ce2 ths
  .dtors          :
134 608e8ce2 ths
  {
135 608e8ce2 ths
    KEEP (*crtbegin*.o(.dtors))
136 608e8ce2 ths
    KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
137 608e8ce2 ths
    KEEP (*(SORT(.dtors.*)))
138 608e8ce2 ths
    KEEP (*(.dtors))
139 608e8ce2 ths
  }
140 608e8ce2 ths
  .jcr            : { KEEP (*(.jcr)) }
141 608e8ce2 ths
  .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
142 608e8ce2 ths
  . = DATA_SEGMENT_RELRO_END (0, .);
143 608e8ce2 ths
  .data           :
144 608e8ce2 ths
  {
145 608e8ce2 ths
    _fdata = . ;
146 608e8ce2 ths
    *(.data .data.* .gnu.linkonce.d.*)
147 608e8ce2 ths
    KEEP (*(.gnu.linkonce.d.*personality*))
148 608e8ce2 ths
    SORT(CONSTRUCTORS)
149 608e8ce2 ths
  }
150 608e8ce2 ths
  .data1          : { *(.data1) }
151 608e8ce2 ths
  . = .;
152 608e8ce2 ths
  _gp = ALIGN(16) + 0x7ff0;
153 608e8ce2 ths
  .got            : { *(.got.plt) *(.got) }
154 608e8ce2 ths
  /* We want the small data sections together, so single-instruction offsets
155 608e8ce2 ths
     can access them all, and initialized data all before uninitialized, so
156 608e8ce2 ths
     we can shorten the on-disk segment size.  */
157 608e8ce2 ths
  .sdata          :
158 608e8ce2 ths
  {
159 608e8ce2 ths
    *(.sdata .sdata.* .gnu.linkonce.s.*)
160 608e8ce2 ths
  }
161 608e8ce2 ths
  .lit8           : { *(.lit8) }
162 608e8ce2 ths
  .lit4           : { *(.lit4) }
163 608e8ce2 ths
  _edata = .; PROVIDE (edata = .);
164 608e8ce2 ths
  __bss_start = .;
165 608e8ce2 ths
  _fbss = .;
166 608e8ce2 ths
  .sbss           :
167 608e8ce2 ths
  {
168 608e8ce2 ths
    *(.dynsbss)
169 608e8ce2 ths
    *(.sbss .sbss.* .gnu.linkonce.sb.*)
170 608e8ce2 ths
    *(.scommon)
171 608e8ce2 ths
  }
172 608e8ce2 ths
  .bss            :
173 608e8ce2 ths
  {
174 608e8ce2 ths
   *(.dynbss)
175 608e8ce2 ths
   *(.bss .bss.* .gnu.linkonce.b.*)
176 608e8ce2 ths
   *(COMMON)
177 608e8ce2 ths
   /* Align here to ensure that the .bss section occupies space up to
178 608e8ce2 ths
      _end.  Align after .bss to ensure correct alignment even if the
179 608e8ce2 ths
      .bss section disappears because there are no input sections.
180 608e8ce2 ths
      FIXME: Why do we need it? When there is no .bss section, we don't
181 608e8ce2 ths
      pad the .data section.  */
182 608e8ce2 ths
   . = ALIGN(. != 0 ? 32 / 8 : 1);
183 608e8ce2 ths
  }
184 608e8ce2 ths
  . = ALIGN(32 / 8);
185 608e8ce2 ths
  . = ALIGN(32 / 8);
186 608e8ce2 ths
  _end = .; PROVIDE (end = .);
187 608e8ce2 ths
  . = DATA_SEGMENT_END (.);
188 608e8ce2 ths
  /* Stabs debugging sections.  */
189 608e8ce2 ths
  .stab          0 : { *(.stab) }
190 608e8ce2 ths
  .stabstr       0 : { *(.stabstr) }
191 608e8ce2 ths
  .stab.excl     0 : { *(.stab.excl) }
192 608e8ce2 ths
  .stab.exclstr  0 : { *(.stab.exclstr) }
193 608e8ce2 ths
  .stab.index    0 : { *(.stab.index) }
194 608e8ce2 ths
  .stab.indexstr 0 : { *(.stab.indexstr) }
195 608e8ce2 ths
  .comment       0 : { *(.comment) }
196 608e8ce2 ths
  /* DWARF debug sections.
197 608e8ce2 ths
     Symbols in the DWARF debugging sections are relative to the beginning
198 608e8ce2 ths
     of the section so we begin them at 0.  */
199 608e8ce2 ths
  /* DWARF 1 */
200 608e8ce2 ths
  .debug          0 : { *(.debug) }
201 608e8ce2 ths
  .line           0 : { *(.line) }
202 608e8ce2 ths
  /* GNU DWARF 1 extensions */
203 608e8ce2 ths
  .debug_srcinfo  0 : { *(.debug_srcinfo) }
204 608e8ce2 ths
  .debug_sfnames  0 : { *(.debug_sfnames) }
205 608e8ce2 ths
  /* DWARF 1.1 and DWARF 2 */
206 608e8ce2 ths
  .debug_aranges  0 : { *(.debug_aranges) }
207 608e8ce2 ths
  .debug_pubnames 0 : { *(.debug_pubnames) }
208 608e8ce2 ths
  /* DWARF 2 */
209 608e8ce2 ths
  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
210 608e8ce2 ths
  .debug_abbrev   0 : { *(.debug_abbrev) }
211 608e8ce2 ths
  .debug_line     0 : { *(.debug_line) }
212 608e8ce2 ths
  .debug_frame    0 : { *(.debug_frame) }
213 608e8ce2 ths
  .debug_str      0 : { *(.debug_str) }
214 608e8ce2 ths
  .debug_loc      0 : { *(.debug_loc) }
215 608e8ce2 ths
  .debug_macinfo  0 : { *(.debug_macinfo) }
216 608e8ce2 ths
  /* SGI/MIPS DWARF 2 extensions */
217 608e8ce2 ths
  .debug_weaknames 0 : { *(.debug_weaknames) }
218 608e8ce2 ths
  .debug_funcnames 0 : { *(.debug_funcnames) }
219 608e8ce2 ths
  .debug_typenames 0 : { *(.debug_typenames) }
220 608e8ce2 ths
  .debug_varnames  0 : { *(.debug_varnames) }
221 608e8ce2 ths
  .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
222 608e8ce2 ths
  .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
223 608e8ce2 ths
  /DISCARD/ : { *(.note.GNU-stack) }
224 608e8ce2 ths
}