Mercurial > ecos-v2_0-branch
annotate packages/hal/mips/idt32334/current/src/mips_idt32334.ld @ 795:db69ea2c9293
Update various .ld and .ldi files to cope with C++ and fix some typos.
Also add a test program for C++ support to infra package.
See individual ChangeLogs for details.
| author | nickg |
|---|---|
| date | Wed, 16 Apr 2003 17:55:07 +0000 |
| parents | e6da0776b0a4 |
| children |
| rev | line source |
|---|---|
| 629 | 1 //=========================================================================== |
| 2 // | |
| 3 // MLT linker script for MIPS IDT32334 | |
| 4 // | |
| 5 //=========================================================================== | |
| 6 //####ECOSGPLCOPYRIGHTBEGIN#### | |
| 7 // ------------------------------------------- | |
| 8 // This file is part of eCos, the Embedded Configurable Operating System. | |
| 9 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. | |
| 10 // | |
| 11 // eCos is free software; you can redistribute it and/or modify it under | |
| 12 // the terms of the GNU General Public License as published by the Free | |
| 13 // Software Foundation; either version 2 or (at your option) any later version. | |
| 14 // | |
| 15 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY | |
| 16 // WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 17 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
| 18 // for more details. | |
| 19 // | |
| 20 // You should have received a copy of the GNU General Public License along | |
| 21 // with eCos; if not, write to the Free Software Foundation, Inc., | |
| 22 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | |
| 23 // | |
| 24 // As a special exception, if other files instantiate templates or use macros | |
| 25 // or inline functions from this file, or you compile this file and link it | |
| 26 // with other works to produce a work based on this file, this file does not | |
| 27 // by itself cause the resulting work to be covered by the GNU General Public | |
| 28 // License. However the source code for this file must still be made available | |
| 29 // in accordance with section (3) of the GNU General Public License. | |
| 30 // | |
| 31 // This exception does not invalidate any other reasons why a work based on | |
| 32 // this file might be covered by the GNU General Public License. | |
| 33 // | |
| 34 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. | |
| 35 // at http://sources.redhat.com/ecos/ecos-license/ | |
| 36 // ------------------------------------------- | |
| 37 //####ECOSGPLCOPYRIGHTEND#### | |
| 38 //=========================================================================== | |
| 39 //#####DESCRIPTIONBEGIN#### | |
| 40 // | |
| 41 // Author(s): tmichals | |
| 42 // Contributors: tmichals | |
| 43 // Date: 2002-09-20 | |
| 44 // Purpose: IDT3233x linker script | |
| 45 // Description: Defines linker script | |
| 46 // Usage: | |
| 47 // | |
| 48 //####DESCRIPTIONEND#### | |
| 49 // | |
| 50 //========================================================================== | |
| 51 | |
| 52 #include <pkgconf/system.h> | |
| 53 | |
| 54 OUTPUT_FORMAT("elf32-bigmips", "elf32-bigmips", | |
| 55 "elf32-littlemips") | |
| 56 /* The preprocessor defines mips, but we know we're mips :-) */ | |
| 57 #undef mips | |
| 58 OUTPUT_ARCH(mips:isa32) | |
| 59 | |
| 60 STARTUP(vectors.o) | |
| 61 ENTRY(reset_vector) | |
| 62 #ifdef EXTRAS | |
| 63 INPUT(extras.o) | |
| 64 #endif | |
|
795
db69ea2c9293
Update various .ld and .ldi files to cope with C++ and fix some typos.
nickg
parents:
629
diff
changeset
|
65 #if (__GNUC__ >= 3) |
|
db69ea2c9293
Update various .ld and .ldi files to cope with C++ and fix some typos.
nickg
parents:
629
diff
changeset
|
66 GROUP(libtarget.a libgcc.a libsupc++.a) |
|
db69ea2c9293
Update various .ld and .ldi files to cope with C++ and fix some typos.
nickg
parents:
629
diff
changeset
|
67 #else |
| 629 | 68 GROUP(libtarget.a libgcc.a) |
|
795
db69ea2c9293
Update various .ld and .ldi files to cope with C++ and fix some typos.
nickg
parents:
629
diff
changeset
|
69 #endif |
| 629 | 70 |
| 71 /* FIXME: The MLT should pass in the required alignment since it must be | |
| 72 * the same as the VMA's alignment. As a result of this bug, all the MIPS32 | |
| 73 * ROM mlt files have alignment 8, when some should have alignment 4 | |
| 74 * (902557-CR) | |
| 75 */ | |
| 76 #define ALIGN_LMA 0x40 | |
| 77 #define FOLLOWING(_section_) AT ((LOADADDR (_section_) + SIZEOF (_section_) + ALIGN_LMA - 1) & ~ (ALIGN_LMA - 1)) | |
| 78 #define LMA_EQ_VMA | |
| 79 #define FORCE_OUTPUT . = . | |
| 80 | |
| 81 #define SECTIONS_BEGIN | |
| 82 | |
| 83 #if defined(CYG_HAL_STARTUP_RAM) | |
| 84 | |
| 85 /* this version for RAM startup */ | |
| 86 #define SECTION_rom_vectors(_region_, _vma_, _lma_) \ | |
| 87 .rom_vectors _vma_ : _lma_ \ | |
| 88 { KEEP (*(.utlb_vector)) \ | |
| 89 . = ALIGN(0x80); KEEP(*(.other_vector)) \ | |
| 90 /* debug and reset vector not used in RAM version */ \ | |
| 91 KEEP(*(.debug_vector)) \ | |
| 92 KEEP (*(.reset_vector)) } \ | |
| 93 > _region_ | |
| 94 | |
| 95 #elif defined(CYG_HAL_STARTUP_ROM) | |
| 96 | |
| 97 /* this version for ROM startup */ | |
| 98 #define SECTION_rom_vectors(_region_, _vma_, _lma_) \ | |
| 99 .rom_vectors _vma_ : _lma_ \ | |
| 100 { KEEP (*(.reset_vector)) \ | |
| 101 . = ALIGN(0x200); KEEP (*(.utlb_vector)) \ | |
| 102 . = . + 0x100; \ | |
| 103 . = ALIGN(0x80); KEEP(*(.other_vector)) \ | |
| 104 . = . + 0x80; \ | |
| 105 . = ALIGN(0x80); KEEP(*(.debug_vector)) } \ | |
| 106 > _region_ | |
| 107 #elif defined(CYG_HAL_STARTUP_ROMRAM) | |
| 108 | |
| 109 /* this version for ROMRAM startup. These are actually a */ | |
| 110 /* combination of the ROM and RAM vector locations since the code */ | |
| 111 /* starts off in ROM and transfers to RAM during startup. */ | |
| 112 #define SECTION_rom_vectors(_region_, _vma_, _lma_) \ | |
| 113 .rom_vectors _vma_ : _lma_ \ | |
| 114 { KEEP (*(.reset_vector)) \ | |
| 115 . = ALIGN(0x100); . = . + 0x80; KEEP (*(.other_vector)) \ | |
| 116 . = . + 0x10; \ | |
| 117 . = ALIGN(0x10); KEEP(*(.utlb_vector)) \ | |
| 118 . = . + 0x10; \ | |
| 119 . = ALIGN(0x80); KEEP(*(.debug_vector)) \ | |
| 120 . = . + 0x100; . = ALIGN(0x600); } \ | |
| 121 > _region_ =0 | |
| 122 | |
| 123 | |
| 124 #endif /* ROM startup version of ROM/RAM vectors */ | |
| 125 | |
| 126 #define SECTION_ROMISC(_region_, _vma_, _lma_) \ | |
| 127 .interp _vma_ : _lma_ { *(.interp) } > _region_ \ | |
| 128 .hash : FOLLOWING(.interp) { *(.hash) } > _region_ \ | |
| 129 .dynsym : FOLLOWING(.hash) { *(.dynsym) } > _region_ \ | |
| 130 .dynstr : FOLLOWING(.dynsym) { *(.dynstr) } > _region_ \ | |
| 131 .gnu.version : FOLLOWING(.dynstr) { *(.gnu.version) } > _region_ \ | |
| 132 .gnu.version_d : FOLLOWING(.gnu.version) { *(.gnu.version_d) } > _region_ \ | |
| 133 .gnu.version_r : FOLLOWING(.gnu.version_d) { *(.gnu.version_r) } > _region_ \ | |
| 134 .plt : FOLLOWING(.gnu.version_r) { *(.plt) } > _region_ | |
| 135 | |
| 136 #define SECTION_RELOCS(_region_, _vma_, _lma_) \ | |
| 137 .rel.text : \ | |
| 138 { \ | |
| 139 *(.rel.text) \ | |
| 140 *(.rel.text.*) \ | |
| 141 *(.rel.gnu.linkonce.t*) \ | |
| 142 } > _region_ \ | |
| 143 .rela.text : \ | |
| 144 { \ | |
| 145 *(.rela.text) \ | |
| 146 *(.rela.text.*) \ | |
| 147 *(.rela.gnu.linkonce.t*) \ | |
| 148 } > _region_ \ | |
| 149 .rel.data : \ | |
| 150 { \ | |
| 151 *(.rel.data) \ | |
| 152 *(.rel.data.*) \ | |
| 153 *(.rel.gnu.linkonce.d*) \ | |
| 154 } > _region_ \ | |
| 155 .rela.data : \ | |
| 156 { \ | |
| 157 *(.rela.data) \ | |
| 158 *(.rela.data.*) \ | |
| 159 *(.rela.gnu.linkonce.d*) \ | |
| 160 } > _region_ \ | |
| 161 .rel.rodata : \ | |
| 162 { \ | |
| 163 *(.rel.rodata) \ | |
| 164 *(.rel.rodata.*) \ | |
| 165 *(.rel.gnu.linkonce.r*) \ | |
| 166 } > _region_ \ | |
| 167 .rela.rodata : \ | |
| 168 { \ | |
| 169 *(.rela.rodata) \ | |
| 170 *(.rela.rodata.*) \ | |
| 171 *(.rela.gnu.linkonce.r*) \ | |
| 172 } > _region_ \ | |
| 173 .rel.got : { *(.rel.got) } > _region_ \ | |
| 174 .rela.got : { *(.rela.got) } > _region_ \ | |
| 175 .rel.ctors : { *(.rel.ctors) } > _region_ \ | |
| 176 .rela.ctors : { *(.rela.ctors) } > _region_ \ | |
| 177 .rel.dtors : { *(.rel.dtors) } > _region_ \ | |
| 178 .rela.dtors : { *(.rela.dtors) } > _region_ \ | |
| 179 .rel.init : { *(.rel.init) } > _region_ \ | |
| 180 .rela.init : { *(.rela.init) } > _region_ \ | |
| 181 .rel.fini : { *(.rel.fini) } > _region_ \ | |
| 182 .rela.fini : { *(.rela.fini) } > _region_ \ | |
| 183 .rel.bss : { *(.rel.bss) } > _region_ \ | |
| 184 .rela.bss : { *(.rela.bss) } > _region_ \ | |
| 185 .rel.plt : { *(.rel.plt) } > _region_ \ | |
| 186 .rela.plt : { *(.rela.plt) } > _region_ \ | |
| 187 .rel.dyn : { *(.rel.dyn) } > _region_ | |
| 188 | |
| 189 #define SECTION_init(_region_, _vma_, _lma_) \ | |
| 190 .init _vma_ : _lma_ \ | |
| 191 { \ | |
| 192 FORCE_OUTPUT; KEEP (*(.init)) \ | |
| 193 } > _region_ =0 | |
| 194 | |
| 195 #define SECTION_text(_region_, _vma_, _lma_) \ | |
| 196 .text _vma_ : _lma_ \ | |
| 197 { \ | |
| 198 _stext = .; _ftext = . ; \ | |
| 199 *(.text) \ | |
| 200 *(.text.*) \ | |
| 201 *(.stub) \ | |
| 202 *(.gnu.warning) \ | |
| 203 *(.gnu.linkonce.t*) \ | |
| 204 *(.mips16.fn.*) *(.mips16.call.*) \ | |
| 205 } > _region_ =0 \ | |
| 206 _etext = .; PROVIDE (etext = .); | |
| 207 | |
| 208 #define SECTION_fini(_region_, _vma_, _lma_) \ | |
| 209 .fini _vma_ : _lma_ \ | |
| 210 { \ | |
| 211 FORCE_OUTPUT; KEEP (*(.fini)) \ | |
| 212 } > _region_ =0 | |
| 213 | |
| 214 #define SECTION_rodata(_region_, _vma_, _lma_) \ | |
| 215 .rodata _vma_ : _lma_ \ | |
| 216 { \ | |
| 217 FORCE_OUTPUT; *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) \ | |
| 218 } > _region_ | |
| 219 | |
| 220 #define SECTION_rodata1(_region_, _vma_, _lma_) \ | |
| 221 .rodata1 _vma_ : _lma_ \ | |
| 222 { \ | |
| 223 FORCE_OUTPUT; *(.rodata1) *(.rodata1.*) \ | |
| 224 } > _region_ | |
| 225 | |
| 226 #define SECTION_vsr_table(_region_, _vma_, _lma_) \ | |
| 227 .vsr_table _vma_ : _lma_ \ | |
| 228 { \ | |
| 229 FORCE_OUTPUT; *(.vsr_table) \ | |
| 230 } > _region_ | |
| 231 | |
| 232 #define SECTION_data(_region_, _vma_, _lma_) \ | |
| 233 .data _vma_ : _lma_ \ | |
| 234 { \ | |
| 235 __ram_data_start = ABSOLUTE (.); _fdata = . ; \ | |
| 236 *(.data) *(.data.*) *(.gnu.linkonce.d*) \ | |
| 237 *( .2ram.*) \ | |
| 238 . = ALIGN (8); \ | |
| 239 SORT(CONSTRUCTORS) \ | |
| 240 } > _region_ \ | |
| 241 __rom_data_start = LOADADDR(.data); | |
| 242 | |
| 243 #define SECTION_data1(_region_, _vma_, _lma_) \ | |
| 244 .data1 _vma_ : _lma_ \ | |
| 245 { \ | |
| 246 FORCE_OUTPUT; *(.data1) *(.data1.*) \ | |
| 247 } > _region_ | |
| 248 | |
| 249 #define SECTION_eh_frame(_region_, _vma_, _lma_) \ | |
| 250 .eh_frame _vma_ : _lma_ \ | |
| 251 { \ | |
| 252 FORCE_OUTPUT; *(.eh_frame) \ | |
| 253 } > _region_ | |
| 254 | |
| 255 #define SECTION_gcc_except_table(_region_, _vma_, _lma_) \ | |
| 256 .gcc_except_table _vma_ : _lma_ \ | |
| 257 { \ | |
| 258 FORCE_OUTPUT; *(.gcc_except_table) \ | |
| 259 } > _region_ | |
| 260 | |
| 261 | |
| 262 /* gcc uses crtbegin.o to find the start of | |
| 263 the constructors, so we make sure it is | |
| 264 first. Because this is a wildcard, it | |
| 265 doesn't matter if the user does not | |
| 266 actually link against crtbegin.o; the | |
| 267 linker won't look for a file to match a | |
| 268 wildcard. The wildcard also means that it | |
| 269 doesn't matter which directory crtbegin.o | |
| 270 is in. */ | |
| 271 | |
| 272 /* We don't want to include the .ctors section from | |
| 273 the crtend.o file until after the sorted ctors. | |
| 274 The .ctor section from the crtend file contains the | |
| 275 end of ctors marker and it must be last */ | |
| 276 | |
| 277 /* FIXME: We shouldn't need to define __CTOR_LIST__/__CTOR_END__ | |
| 278 and __DTOR_LIST__/__DTOR_END__ except by the PROVIDE lines. | |
| 279 However this doesn't work for old (99r1-era) toolchains, so | |
| 280 leave it for now. */ | |
| 281 | |
| 282 #define SECTION_ctors(_region_, _vma_, _lma_) \ | |
| 283 .ctors _vma_ : _lma_ \ | |
| 284 { \ | |
| 285 FORCE_OUTPUT; \ | |
| 286 KEEP (*crtbegin.o(.ctors)) \ | |
| 287 __CTOR_LIST__ = .; \ | |
| 288 PROVIDE (__CTOR_LIST__ = .); \ | |
| 289 KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) \ | |
| 290 KEEP (*(SORT(.ctors.*))) \ | |
| 291 KEEP (*(.ctors)) \ | |
| 292 __CTOR_END__ = .; \ | |
| 293 PROVIDE (__CTOR_END__ = .); \ | |
| 294 } > _region_ | |
| 295 | |
| 296 #define SECTION_dtors(_region_, _vma_, _lma_) \ | |
| 297 .dtors _vma_ : _lma_ \ | |
| 298 { \ | |
| 299 FORCE_OUTPUT; \ | |
| 300 KEEP (*crtbegin.o(.dtors)) \ | |
| 301 __DTOR_LIST__ = .; \ | |
| 302 PROVIDE (__DTOR_LIST__ = .); \ | |
| 303 KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) \ | |
| 304 KEEP (*(SORT(.dtors.*))) \ | |
| 305 KEEP (*(.dtors)) \ | |
| 306 __DTOR_END__ = .; \ | |
| 307 PROVIDE (__DTOR_END__ = .); \ | |
| 308 } > _region_ | |
| 309 | |
| 310 #define SECTION_devtab(_region_, _vma_, _lma_) \ | |
| 311 .devtab _vma_ : _lma_ \ | |
| 312 { \ | |
| 313 FORCE_OUTPUT; \ | |
| 314 KEEP(*( SORT (.ecos.table.*))) ; \ | |
| 315 } > _region_ | |
| 316 | |
| 317 #define SECTION_got(_region_, _vma_, _lma_) \ | |
| 318 _gp = ALIGN(16) + 0x7ff0; \ | |
| 319 .got _vma_ : _lma_ \ | |
| 320 { \ | |
| 321 FORCE_OUTPUT; *(.got.plt) *(.got) \ | |
| 322 } > _region_ | |
| 323 | |
| 324 #define SECTION_dynamic(_region_, _vma_, _lma_) \ | |
| 325 .dynamic _vma_ : _lma_ \ | |
| 326 { \ | |
| 327 FORCE_OUTPUT; *(.dynamic) \ | |
| 328 } > _region_ | |
| 329 | |
| 330 /* We want the small data sections together, so single-instruction offsets | |
| 331 can access them all, and initialized data all before uninitialized, so | |
| 332 we can shorten the on-disk segment size. */ | |
| 333 | |
| 334 #define SECTION_sdata(_region_, _vma_, _lma_) \ | |
| 335 .sdata _vma_ : _lma_ \ | |
| 336 { \ | |
|
795
db69ea2c9293
Update various .ld and .ldi files to cope with C++ and fix some typos.
nickg
parents:
629
diff
changeset
|
337 FORCE_OUTPUT; *(.sdata) *(.sdata.*) *(.gnu.linkonce.s*) \ |
| 629 | 338 } > _region_ |
| 339 | |
| 340 #define SECTION_lit8(_region_, _vma_, _lma_) \ | |
| 341 .lit8 _vma_ : _lma_ \ | |
| 342 { \ | |
| 343 FORCE_OUTPUT; *(.lit8) \ | |
| 344 } > _region_ | |
| 345 | |
| 346 #define SECTION_lit4(_region_, _vma_, _lma_) \ | |
| 347 .lit4 : FOLLOWING(.lit8) \ | |
| 348 { \ | |
| 349 FORCE_OUTPUT; *(.lit4) \ | |
| 350 } > _region_ \ | |
| 351 __ram_data_end = .; _edata = . ; \ | |
| 352 PROVIDE (edata = .); | |
| 353 | |
| 354 #define SECTION_sbss(_region_, _vma_, _lma_) \ | |
| 355 __bss_start = .; _fbss = .; \ | |
| 356 .sbss _vma_ : _lma_ \ | |
| 357 { \ | |
| 358 FORCE_OUTPUT; *(.dynsbss) *(.sbss) *(.sbss.*) *(.scommon) \ | |
| 359 } > _region_ | |
| 360 | |
| 361 #define SECTION_bss(_region_, _vma_, _lma_) \ | |
| 362 .bss _vma_ : _lma_ \ | |
| 363 { \ | |
| 364 *(.dynbss) *(.bss) *(.bss.*) *(COMMON) \ | |
| 365 } > _region_ \ | |
| 366 __bss_end = .; | |
| 367 | |
| 368 /* The /DISCARD/ section ensures that the output will not contain a | |
| 369 * .mdebug section as it confuses GDB. This is a workaround for CR 100804. | |
| 370 */ | |
| 371 | |
| 372 #define SECTIONS_END . = ALIGN(4); _end = .; PROVIDE (end = .); \ | |
| 373 /* Stabs debugging sections. */ \ | |
| 374 .stab 0 : { *(.stab) } \ | |
| 375 .stabstr 0 : { *(.stabstr) } \ | |
| 376 .stab.excl 0 : { *(.stab.excl) } \ | |
| 377 .stab.exclstr 0 : { *(.stab.exclstr) } \ | |
| 378 .stab.index 0 : { *(.stab.index) } \ | |
| 379 .stab.indexstr 0 : { *(.stab.indexstr) } \ | |
| 380 .comment 0 : { *(.comment) } \ | |
| 381 /* DWARF debug sections. \ | |
| 382 Symbols in the DWARF debugging sections are relative to \ | |
| 383 the beginning of the section so we begin them at 0. */ \ | |
| 384 /* DWARF 1 */ \ | |
| 385 .debug 0 : { *(.debug) } \ | |
| 386 .line 0 : { *(.line) } \ | |
| 387 /* GNU DWARF 1 extensions */ \ | |
| 388 .debug_srcinfo 0 : { *(.debug_srcinfo) } \ | |
| 389 .debug_sfnames 0 : { *(.debug_sfnames) } \ | |
| 390 /* DWARF 1.1 and DWARF 2 */ \ | |
| 391 .debug_aranges 0 : { *(.debug_aranges) } \ | |
| 392 .debug_pubnames 0 : { *(.debug_pubnames) } \ | |
| 393 /* DWARF 2 */ \ | |
| 394 .debug_info 0 : { *(.debug_info) } \ | |
| 395 .debug_abbrev 0 : { *(.debug_abbrev) } \ | |
| 396 .debug_line 0 : { *(.debug_line) } \ | |
| 397 .debug_frame 0 : { *(.debug_frame) } \ | |
| 398 .debug_str 0 : { *(.debug_str) } \ | |
| 399 .debug_loc 0 : { *(.debug_loc) } \ | |
| 400 .debug_macinfo 0 : { *(.debug_macinfo) } \ | |
| 401 /* SGI/MIPS DWARF 2 extensions */ \ | |
| 402 .debug_weaknames 0 : { *(.debug_weaknames) } \ | |
| 403 .debug_funcnames 0 : { *(.debug_funcnames) } \ | |
| 404 .debug_typenames 0 : { *(.debug_typenames) } \ | |
| 405 .debug_varnames 0 : { *(.debug_varnames) } \ | |
| 406 /* These must appear regardless of . */ \ | |
| 407 .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } \ | |
| 408 .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } \ | |
| 409 /DISCARD/ 0 : { *(.mdebug) } | |
| 410 | |
| 411 #include CYGHWR_MEMORY_LAYOUT_LDI | |
| 412 | |
| 413 hal_vsr_table = 0x80000300; | |
| 414 hal_virtual_vector_table = 0x80000400; | |
| 415 | |
| 416 // EOF mips_idt32334.ld |
