This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: V850, linker script problem
- From: Torsten Mohr <tmohr at s dot netic dot de>
- To: binutils at sourceware dot org
- Date: Sat, 6 May 2006 13:21:11 +0200
- Subject: Re: V850, linker script problem
- References: <200605032120.02870.tmohr@s.netic.de>
Hi,
i'm sorry to bother you with this one again, but i'm not sure if
the behaviour below is a bug or if i do something wrong. As
i haven't received any answers i think that nobody can easily
say where i did something wrong. But i'm not sure about that.
It would be great if anybody could give me a comment if the
behaviour below looks like i did something wrong or if it
basically should work.
At the moment i have no clue on how to continue. One more thing,
the toolchain is set up on MSYS/MinGW and i manually changed two
thing:
1. changed gcc/Makefile to NOT use/build collect2.exe
2. gcc/config/v850/lib1funcs.asm, line 1459 i commented out
the change of the section
Thanks for any hints,
Torsten.
> Hi,
>
> thank you all for the hints so far, but until now i still
> have the problem with the linker script.
>
> I tried to cut down the project as much as possible to only
> reflect the strange behaviour and not much more.
>
> In the linker script v850.x i put .data to ROM to copy it into
> RAM at startup. This results in the mapfile:
>
> From linker Script:
> .data :
> {
> *(.data)
> *(.data.*)
> *(.gnu.linkonce.d*)
> CONSTRUCTORS
> } > ram AT > rom
>
>
> From map file:
>
> .data 0x03ffe000 0x0 load address 0x00000678
> *(.data)
> *(.data.*)
> *(.gnu.linkonce.d*)
>
> I expected the same for .tdata and even more for .sdata as this
> one has only one entry, but i get:
>
>
> From linker script:
> .tdata ALIGN(4) :
> {
> *(.tbyte)
> *(.tcommon_byte)
> *(.tdata)
> *(.tbss)
> *(.tcommon)
> } >ram AT>rom
>
> __ep = ADDR(.tdata);
>
>
> .sdata ALIGN (4) :
> {
> *(.sdata)
> } >ram AT > rom
> __gp = ADDR(.sdata) + 0x8000;
>
>
> From map file:
>
> .tdata 0x00000678 0x0 load address 0x00000678
> *(.tbyte)
> *(.tcommon_byte)
> *(.tdata)
> *(.tbss)
> *(.tcommon)
> 0x00000678 __ep = ADDR (.tdata)
>
> .sdata 0x00000678 0x0 load address 0x00000678
> *(.sdata)
> 0x00008678 __gp = (ADDR (.sdata) + 0x8000)
>
> At linking i get:
> v850e-unknown-elf-ld -o hw2.elf \
> -Map=hw2.map \
> -Tv850.x \
> -nostdlib \
> main.o vectors.o
> v850e-unknown-elf-ld: address 0x678 of hw2.elf \
> section .tdata is not within region ram
>
> v850e-unknown-elf-ld: address 0x678 of hw2.elf \
> section .sdata is not within region ram
>
>
> I don't know why the address of .tdata and .sdata is set to its
> _load_ address and not to an address in RAM. For .data it
> worked as expected.
>
> Of course i can send the sources, the ELF file and any other
> data that are needed to this list.
>
> For reference i attach the linker script and the two short source
> files to the end of this mail.
>
>
> Best regards,
> Torsten.
>
> v850.x
> OUTPUT_FORMAT("elf32-v850", "elf32-v850", "elf32-v850")
> OUTPUT_ARCH(v850)
> ENTRY(_start)
> SEARCH_DIR(.);
> EXTERN(__ctbp __ep __gp);
>
> MEMORY
> {
> vect(rx) : org = 0x00000000, len = 0x640
> rom(rx) : org = 0x00000640, len = 512k
> ram(rwx) : org = 0x03ffe000, len = 15k
> stack(rw) : org = 0x03fffc00, len = 1k
> }
>
> SECTIONS
> {
> .vect :
> {
> *(.vect)
> } >vect
>
> .zdata :
> {
> *(.zdata)
> *(.zbss)
> *(reszdata)
> *(.zcommon)
> } >ram
>
> .rozdata ALIGN (4) :
> {
> *(.rozdata)
> *(romzdata)
> *(romzbss)
> } >rom
>
>
> .text :
> {
> *(.text)
> *(.text.*)
> *(.gnu.warning)
> *(.gnu.linkonce.t*)
> } > rom
> _etext = .;
> PROVIDE (etext = .);
>
> .call_table_data ALIGN (4) :
> {
> *(.call_table_data)
> } > rom = 0xff
> __ctbp = ADDR(.call_table_data);
>
> .call_table_text :
> {
> *(.call_table_text)
> } > rom
>
> .data :
> {
> *(.data)
> *(.data.*)
> *(.gnu.linkonce.d*)
> CONSTRUCTORS
> } > ram AT > rom
> .data1 : { *(.data1) } > rom
>
> .gcc_except_table : { *(.gcc_except_table) } >rom
> .got : { *(.got.plt) *(.got) } >rom
>
> .dynamic : {
> *(.dynamic)
> . = ALIGN(2);
> PROVIDE(__romdatastart = .); /* IF_ROCOPY */
> } >rom
>
>
> .tdata ALIGN(4) :
> {
> *(.tbyte)
> *(.tcommon_byte)
> *(.tdata)
> *(.tbss)
> *(.tcommon)
> } > ram AT > rom
>
> __ep = ADDR(.tdata);
>
>
> .sdata ALIGN (4) :
> {
> *(.sdata)
> } > ram AT > rom
> __gp = ADDR(.sdata) + 0x8000;
>
> .rosdata ALIGN (4) :
> {
> *(.rosdata)
> } >rom
>
> .sbss :
> {
> __sbss_start = .;
> *(.sbss)
> *(.scommon)
> } >ram
> _edata = DEFINED (__sbss_start) ? __sbss_start : . ;
> PROVIDE (edata = _edata);
> .bss :
> {
> __bss_start = DEFINED (__sbss_start) ? __sbss_start : . ;
> __real_bss_start = . ;
> *(.dynbss)
> *(.bss)
> *(COMMON)
> } >ram
> _end = . ;
> PROVIDE (end = .);
>
> .comment 0 : { *(.comment) }
>
> .stack :
> {
> __stack = .;
> *(.stack)
> } >stack
> }
>
>
>
> vectors.S:
> .global _start
> .global _main
>
> .section .vect,"ax",@progbits
>
> .offset 0x00
> jr _start
>
>
>
> _start:
> jr _main
>
>
>
> main.c:
> int main(int argc, char** argv) {
> volatile int i;
> volatile unsigned char p;
>
>
> while(1) {
> p++;
> for(i = 0; i < 1000; i++);
> }
>
> return 0;
> }