This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Linker problem...
- From: Nick Clifton <nickc at redhat dot com>
- To: Gerhard Jaeger <g dot jaeger at sysgo dot com>
- Cc: binutils at sources dot redhat dot com, hongjiu dot lu at intel dot com, amodra at bigpond dot net dot au
- Date: Tue, 30 Aug 2005 17:10:59 +0100
- Subject: Re: Linker problem...
- References: <200508301513.04728.g.jaeger@sysgo.com>
Hi Gerhard,
_edata = .;
PROVIDE (edata = .);
__u_boot_cmd_start = .;
.u_boot_cmd : { *(.u_boot_cmd) }
The binutils-2.16.1 (and also the latests snapshots) create the following map output:
fffe7bd8 D env_name_spec
fffe7bdc A __u_boot_cmd_start
fffe7bdc A _edata
[...]
fffe8384 D desc_and_len_tbl
fffe83b4 D __u_boot_cmd_autoscr
__u_boot_cmd_start is placed wrong here, and the resulting bootloader does not
work correctly.
It looks like you need to fix up the linker script. From ld.texinfo:
dot outside sections
Setting symbols to the value of the location counter outside
of an output section statement can result in unexpected values
if the linker needs to place orphan sections. For example,
given the following:
SECTIONS
{
start_of_text = . ;
.text: { *(.text) }
end_of_text = . ;
start_of_data = . ;
.data: { *(.data) }
end_of_data = . ;
}
[...] As well, the linker doesn't associate the above
symbol names with their sections. Instead, it assumes
that all assignments or other statements belong to the
previous output section, except for the special case of
an assignment to . [...] So you could write:
SECTIONS
{
start_of_text = . ;
.text: { *(.text) }
end_of_text = . ;
. = . ;
start_of_data = . ;
.data: { *(.data) }
end_of_data = . ;
}
Cheers
Nick