Statistics
| Branch: | Revision:

root / mips.ld @ 72249e34

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