This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Problems to select input-section for objectfile(.txt) within linker script file
- From: "Duemer, Karl Heinz" <karlheinz dot duemer at siemens dot com>
- To: <gcc-help at gcc dot gnu dot org>
- Date: Fri, 27 Jan 2006 12:58:05 +0100
- Subject: Problems to select input-section for objectfile(.txt) within linker script file
Hello,
I am trying to link the (.txt) sections of some object-files to defined locations, but I am not able to select them within the linker script file.
I use mips64-linux-gnu-gcc in the Version 3.4.3.
A simple example includes two very simple c-files h1.c and h2.c.
The compiler commands are:
mips64-linux-gnu-gcc -O0 -g -EB -mabi=64 -march=rm9000 -mno-abicalls -fno-pic -Wa,-ahl=h1.lst -o h1.o -c h1.c
mips64-linux-gnu-gcc -O0 -g -EB -mabi=64 -march=rm9000 -mno-abicalls -fno-pic -Wa,-ahl=h1.lst -o h2.o -c h2.c
The Linker command is:
mips64-linux-gnu-gcc -Tscript.ld -EB -mabi=64 -march=rm9000 -nostdlib -e main -Wl,-M -Wl,-Map=h12.map -o h12 h1.o h2.o
The linker-script script.ld starts with:
OUTPUT_ARCH(mips)
SECTIONS
{
.text 0xffffffff80100000 :
{
h1.o(.txt)
. += 100;
h2.o(.txt)
CREATE_OBJECT_SYMBOLS
}
.....
The h12.map file shows the problem:
The (.txt) sections are not fetched as requestet (gap of 100 bytes between the two parts).
The input-section directives h1.o(.txt) and h2.o(.txt) are recognized, but ignored...
The real (.txt) sections are linked after the gap of 100 bytes.
...
Linker script and memory map
LOAD h1.o
LOAD h2.o
.text 0xffffffff80100000 0xf0
h1.o(.txt)
0xffffffff80100064 . = (. + 0x64)
*fill* 0xffffffff80100000 0x64 00
h2.o(.txt)
CREATE_OBJECT_SYMBOLS
*fill* 0xffffffff80100064 0xc 00
.text 0xffffffff80100070 0x50 h1.o
0xffffffff80100070 main
.text 0xffffffff801000c0 0x30 h2.o
0xffffffff801000c0 h2
The selection of self-defined section in assembler modules works fine.
Example: h3.o(unmapped_uncached) for a an assembler-module h3.o including the line: .section unmapped_uncached
My target is:
We have a a mix of assembler, C and Chill-SW. The chill linker delivers no ELF-Debug-Information.
I want to derive the debug-info for assembler and C from a gcc-output without Chill-SW (only dummies), but with the 'right' addresses for C and assembler code.
many greetings from
Karl-Heinz Dümer
Siemens AG
Com PV PD AP
Machtelfingerstr. 1
D-81359 München
Tel.: +49 89 / 722-24405
Mail:karlheinz.duemer@siemens.com