This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Can we move location counter backwards?


On Tue, Aug 22, 2006 at 10:22:52AM -0700, H. J. Lu wrote:
> The linker manual says "The location counter may never be moved
> backwards." But in the same manual, there are
> 
>    Note that the `OVERLAY' command is just syntactic sugar, since
> everything it does can be done using the more basic commands.  The
> above example could have been written identically as follows.
> 
>        .text0 0x1000 : AT (0x4000) { o1/*.o(.text) }
>        __load_start_text0 = LOADADDR (.text0);
>        __load_stop_text0 = LOADADDR (.text0) + SIZEOF (.text0);
>        .text1 0x1000 : AT (0x4000 + SIZEOF (.text0)) { o2/*.o(.text) }
>        __load_start_text1 = LOADADDR (.text1);
>        __load_stop_text1 = LOADADDR (.text1) + SIZEOF (.text1);
>        . = 0x1000 + MAX (SIZEOF (.text0), SIZEOF (.text1));
> 
> It moves the location counter backwards implicitly. It is the same as
> 
>        .text0 0x1000 : AT (0x4000) { o1/*.o(.text) }
>        __load_start_text0 = LOADADDR (.text0);
>        __load_stop_text0 = LOADADDR (.text0) + SIZEOF (.text0);
>        . = 0x1000;
>        .text1 : AT (0x4000 + SIZEOF (.text0)) { o2/*.o(.text) }
>        __load_start_text1 = LOADADDR (.text1);
>        __load_stop_text1 = LOADADDR (.text1) + SIZEOF (.text1);
>        . = 0x1000 + MAX (SIZEOF (.text0), SIZEOF (.text1));
> 
> Given that linker does allow/support moving the location counter
> backwards, should we remove "The location counter may never be moved
> backwards." from the linker manual?

Nevermind. The linker manual has been updated.


H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]