From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27995 invoked by alias); 8 May 2006 20:42:53 -0000 Received: (qmail 27984 invoked by uid 22791); 8 May 2006 20:42:53 -0000 X-Spam-Check-By: sourceware.org Received: from mail.s.netic.de (HELO mail.s.netic.de) (212.9.160.11) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 08 May 2006 20:42:49 +0000 Received: from host-213-178-187-10.dsl.netic.de ([213.178.187.10] helo=schleim.qwe.de) by mail.s.netic.de with esmtp (Exim 4.51) id 1FdCZ4-000GNz-4n; Mon, 08 May 2006 22:42:46 +0200 Received: from localhost (localhost [IPv6:::1]) by schleim.qwe.de (Postfix) with ESMTP id B803A3A783; Mon, 8 May 2006 22:45:01 +0200 (CEST) From: Torsten Mohr To: Erik Christiansen Subject: Re: V850, linker script problem Date: Tue, 09 May 2006 01:11:00 -0000 User-Agent: KMail/1.8 Cc: binutils@sourceware.org References: <200605032120.02870.tmohr@s.netic.de> <200605071240.05374.tmohr@s.netic.de> <20060508064414.GE7585@dd.nec.com.au> In-Reply-To: <20060508064414.GE7585@dd.nec.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200605082245.01277.tmohr@s.netic.de> X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2006-05/txt/msg00153.txt.bz2 Hi, i rearragned the sections in the linker script and by that the problem disappeared. I know that the order of sections matters, but the problem here was not obvious to me and i can't really explain it. Previously the order was (not all sections shown): .text .call_table_data .call_table_text .fini .rodata .rodata1 .data .data1 .ctors .dtors .jcr .gcc_except_table .got .dynamic .tdata .sdata .rosdata Now it is: .text .call_table_data .call_table_text .data .data1 .sdata .tdata .ctors # .dtors # .gcc_except_table # .got # .dynamic .sbss Basically, i moved .tdata and .sdata before the sections marked with '#'. As there is no overview of all sections available, i copied all section names from the original V850 linker script and put my assumptions in front of it. I wonder why all the rela.* and rel.* get merged into the text segment in the original. I was searching for some of the sections with google but did not really find an answer. It would be great if anybody could give me a hint on where to place the sections in the target, especially .dynamic . RAM .zdata ROM .rozdata ROM .interp ROM .hash ROM .dynsym ROM .dynstr ROM .rel.text ROM .rela.text ROM .rel.data ROM .rela.data ROM .rel.rodata ROM .rela.rodata ROM .rel.gcc_except_table ROM .rela.gcc_except_table ROM .rel.got ROM .rela.got ROM .rel.ctors ROM .rela.ctors ROM .rel.dtors ROM .rela.dtors ROM .rel.init ROM .rela.init ROM .rel.fini ROM .rela.fini ROM .rel.bss ROM .rela.bss ROM .rel.plt ROM .rela.plt ROM .init ROM .plt ROM .text ROM .call_table_data ROM .call_table_text ROM .fini ROM .rodata ROM .rodata1 RAM>ROM .data RAM>ROM .data1 ROM .ctors ROM .dtors ROM .jcr ROM .gcc_except_table ROM .got ??? .dynamic RAM>ROM .tdata RAM>ROM .sdata ROM .rosdata RAM .sbss RAM .bss DEBUG .stab DEBUG .stabstr DEBUG .stab.excl DEBUG .stab.exclstr DEBUG .stab.index DEBUG .stab.indexstr DEBUG .comment DEBUG .debug DEBUG .line DEBUG .debug_srcinfo DEBUG .debug_sfnames DEBUG .debug_aranges DEBUG .debug_pubnames DEBUG .debug_info DEBUG .debug_abbrev DEBUG .debug_line DEBUG .debug_frame DEBUG .debug_str DEBUG .debug_loc DEBUG .debug_macinfo DEBUG .debug_weaknames DEBUG .debug_funcnames DEBUG .debug_typenames DEBUG .debug_varnames RAM .stack Basically, i think i need to clear all RAM sections and copy all RAM>ROM sections from ROM to RAM. Is that correct? Erik, is the test below still needed? Thanks for any hints, Torsten. > > I added another section for testing: > > > > .myqwe : > > { > > *(.myqwe) > > } > ram AT > rom > > > > in vectors.S: > > .section .myqwe,"w" > > .string "abcdefg" > > > > It leads to exactly the behaviour i expect: > > > > .myqwe 0x03ffe000 0x8 load address 0x00000678 > > *(.myqwe) > > .myqwe 0x03ffe000 0x8 vectors.o > > > > I wonder why defining the sections the same way does not work > > for ".sdata" and for ".tdata". > > A clue might be found in linking with something like: > > LDFLAGS = -L /usr/local/lib/gcc/v850e/4.0.2/ -lc -lgcc > v850-ld -verbose -T your_linker_script -o test.elf your_object_files \ > $(LDFLAGS) -M > test.map > > (N.B. You're maybe not using gcc 4.0.2) > > Allowing gcc to intrude into the linking process is a variable not fully > in your control. The above works for me, using the alternative "AT" > syntax in the linker script. > > > C: > > The sections .sdata and .tdata are empty, but also when i add > > some data to it it results in the same error message. > > What happens if you rename these output sections elephant and zebra? > (The only consequential changes should be any linker script lines which > use ADDR or LOADADDR of these sections.) > > Erik