This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: loadaddr forward ref problem
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Nathan Sidwell <nathan at codesourcery dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Fri, 2 Mar 2007 09:10:04 +1030
- Subject: Re: loadaddr forward ref problem
- References: <45E6DD1E.5050400@codesourcery.com>
On Thu, Mar 01, 2007 at 02:03:10PM +0000, Nathan Sidwell wrote:
> Should we accept the following linker script?
>
> SECTIONS
> {
> .text :
> {
> _start = .;
> LONG (__data_load)
> }
> .data :
> {
> __data_load = LOADADDR (.data);
> }
> }
In an ideal world I guess we would accept this. We should know the
vma and lma at the start of the section, so be able to use them in
assignment expressions. However, we don't know the size of the
section at that point and ld uses one flag, processed_vma, to check
for both vma and size validity. For that reason, and because ld
wants to know the section size before setting the lma (see "dot moved
backward" warning), we don't allow ADDR, LOADADDR and SIZEOF to refer
to the current section until the section closing brace, except in the
case of AT expression setting lma.
> The linker script can be made to work by moving the __data_load assignment
> outside of the .data section. Is that the right way to handle this issue?
For now, yes.
--
Alan Modra
IBM OzLabs - Linux Technology Centre