This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: a question about link script
- From: Nick Clifton <nickc at redhat dot com>
- To: "Martin Bian" <martin at utstar dot com>
- Cc: "binutils at sources dot redhat dot com" <binutils at sources dot redhat dot com>
- Date: 29 Jan 2003 08:56:22 +0000
- Subject: Re: a question about link script
- References: <200301281149.h0SBnTe01786@tiger.utstar.com.cn>
Hi Martin,
> Thanks for your answer, but I think you don't understand me. Maybe I
> don't express my question very clear,sorry. I use a example to
> express it. If I have three obj files, a.o, b.o and c.o, I should
> link them as an elf file. My aim is:1. program executes from the
> first instruction in b.o; 2. the first instruction of b.o is located
> at address 0.
> If I use command "ld -T link.script -o xx.elf b.o a.o c.o", the
> first instruction will be at address 0. But I use a auto makefile,
> so I can't specify it every time. I need a auto solution.
Try creating a separate entry for b.o in your linker script like this:
SECTIONS
{
. = 0
.text {
b.o(.text)
*(.text)
}
....
This will force the .text section from the b.o file to be placed at
the start of the .text section in the executable, regardless of where
b.o was specified on the linker command line.
Cheers
Nick