* m68k-elf: Zeroed area in ELF file
@ 2008-07-22 19:24 Christian Meusel
0 siblings, 0 replies; only message in thread
From: Christian Meusel @ 2008-07-22 19:24 UTC (permalink / raw)
To: gcc-help
[-- Attachment #1.1: Type: text/plain, Size: 1359 bytes --]
Hello!
I'm compiling eCos for the ColdFire MCF5282. When linking all together,
the resulting ELF file contains a corrupted interrupt vector table.
Excactly the first kilobyte of the ROM interrupt vector table is zeroed
- no matter what the code from object or archive files contains.
Linking occurs with help of the attached linker script and linking is
invoked as follows:
m68k-elf-gcc -m528x -g -nostdlib -Wl,--gc-sections \
-Wl,-static -L<BUILDPATH>/install/lib -Ttarget.ld \
-o <BUILDPATH>/install/bin/redboot.elf \
<BUILDPATH>/install/lib/version.o
The data for the vector table is provided in an archive named
libtarget.a which is referenced by the linker script. In this archive,
the vector table contains references to relocatable symbols.
When compiling and linking with GCC 3.4.6 I'm getting the expected
result with correctly resolved symbols in the interrupt vector table.
The situation changes when I'm using one of the following GCC 4 variants:
GCC 4.0.4
GCC 4.1.2
GCC 4.2.4
All ELF files generated by using these versions for linking have the
first kilobyte of the interrupt vector table zeroed. The interrupt
vector table resides in the section ".romvec" at the lowest ROM address.
Any ideas? How to make GCC 4 not to zero the first kilobyte of ROM?
Best regards
Christian
[-- Attachment #1.2: target.ld --]
[-- Type: text/plain, Size: 3598 bytes --]
STARTUP(vectors.o)
ENTRY(_start)
INPUT(extras.o)
GROUP(libtarget.a libgcc.a libsupc++.a)
MEMORY
{
sdram : ORIGIN = 0x00000000, LENGTH = 0x01000000
devs : ORIGIN = 0x40000000, LENGTH = 0x40000000
sram : ORIGIN = 0x20000000, LENGTH = 0x00010000
int_flash : ORIGIN = 0xF0000000, LENGTH = 0x00040000
ext_flash : ORIGIN = 0xFFE00000, LENGTH = 0x00200000
}
SECTIONS
{
.romvec 0xF0000000 : { __romvec_start = ABSOLUTE (.); . = .; KEEP(*(.romvec)); . = ALIGN(4); __romvec_end = ABSOLUTE (.); __romvec_size = ABSOLUTE (.) - ABSOLUTE(__romvec_start); } > int_flash
.boot ALIGN (0x4) : { . = .; *(.boot*) . = ALIGN(4); } > int_flash
.text ALIGN (0x4) : { _stext = .; *(.text*) *(.gnu.warning) *(.gnu.linkonce*) *(.init) . = ALIGN(4); } > int_flash _etext = .; PROVIDE (etext = .);
.fini ALIGN (0x4) : { . = .; *(.fini) . = ALIGN(4); } > int_flash
.rodata1 ALIGN (0x4) : { . = .; *(.rodata1*) . = ALIGN(4); } > int_flash
.rodata ALIGN (0x4) : { . = .; *(.rodata*) . = ALIGN(4); } > int_flash
.fixup ALIGN (0x4) : { __FIXUP_START__ = ABSOLUTE(.); *(.fixup) . = ALIGN(4); __FIXUP_END__ = ABSOLUTE(.); } > int_flash
.gcc_except_table ALIGN (0x4) : { __EXCEPT_START__ = ABSOLUTE(.); *(.gcc_except_table) . = ALIGN(4); __EXCEPT_END__ = ABSOLUTE(.); } > int_flash
.ramvec 0x20000000 (NOLOAD) : { __ramvec_start = ABSOLUTE (.); . = .; KEEP(*(.ramvec)); . = ALIGN(4); __ramvec_end = ABSOLUTE (.); __ramvec_size = ABSOLUTE (.) - ABSOLUTE(__ramvec_start); } > sram
.virtual_vec_table ALIGN (0x4) (NOLOAD) : { __virtual_vec_table_start = ABSOLUTE (.); . += 0x100; __virtual_vec_table_end = ABSOLUTE (.); __virtual_vec_table_size = ABSOLUTE (.) - ABSOLUTE(__virtual_vec_table_start); } > sram
.data ALIGN (0x4) : AT ((LOADADDR (.gcc_except_table) + SIZEOF (.gcc_except_table) + 4 - 1) & ~ (4 - 1)) { __ram_data_start = ABSOLUTE(.); *(.data*) __GOT1_START__ = ABSOLUTE(.); *(.got1) __GOT1_END__ = ABSOLUTE(.); . = ALIGN (4); __CTOR_LIST__ = ABSOLUTE(.); KEEP(*(SORT(.ctors*))); __CTOR_END__ = ABSOLUTE(.); __DTOR_LIST__ = ABSOLUTE(.); KEEP(*(SORT(.dtors*))) __DTOR_END__ = ABSOLUTE(.); . = ALIGN(4); KEEP(*( SORT (.ecos.table.*))); . = ALIGN (4); *( .2ram.*) ; __GOT2_START__ = ABSOLUTE(.); *(.got2) __GOT2_END__ = ABSOLUTE(.); __GOT_START = ABSOLUTE(.); _GLOBAL_OFFSET_TABLE_ = ABSOLUTE(. + 32768); _SDA_BASE_ = ABSOLUTE(.); *(.got.plt) *(.got) __GOT_END__ = ABSOLUTE(.); *(.dynamic) *(.eh_frame) __SDATA_START__ = ABSOLUTE(.); *(.sdata) *(.sdata.*) __SDATA2_START__ = ABSOLUTE(.); *(.sdata2*) . = ALIGN(4); __ram_data_end = ABSOLUTE(.); __ram_data_size = ABSOLUTE (.) - ABSOLUTE(__ram_data_start); } > sram __rom_data_start = LOADADDR(.data); __rom_data_size = SIZEOF(.data); __rom_data_end = __rom_data_start + __rom_data_size;
.bss ALIGN (0x4) (NOLOAD) : { __bss_start = ABSOLUTE (.); . = .; *(.dynbss*) *(.bss*) *(COMMON) *(.sbss*) *(.scommon*) . = ALIGN(4); __bss_end = ABSOLUTE (.); __bss_size = ABSOLUTE (.) - ABSOLUTE(__bss_start); } > sram
.uninvar ALIGN (0x4) (NOLOAD) : { __uninvar_start = ABSOLUTE (.); . = .; *(.uninvar); . = ALIGN(4); __uninvar_end = ABSOLUTE (.); __uninvar_size = ABSOLUTE (.) - ABSOLUTE(__uninvar_start); } > sram
__heap1 = ALIGN (0x4);
__romram_copy_source = LOADADDR(.data);
__romram_copy_dest = ADDR(.data);
__romram_copy_length = SIZEOF(.data);
.stab 0 (NOLOAD) : { *(.stab) } .stabstr 0 (NOLOAD) : { *(.stabstr) } .comment 0 (NOLOAD) : { *(.comment) } . = ALIGN(0x4); _end = .; PROVIDE (end = .);
}
hal_virtual_vector_table = __virtual_vec_table_start;
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/x-pkcs7-signature, Size: 3367 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-07-22 13:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-22 19:24 m68k-elf: Zeroed area in ELF file Christian Meusel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).