This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Strange LMA/VMA behavior with regions
On 13 May 2011 05:03, Alan Modra <amodra@gmail.com> wrote:
> On Thu, May 12, 2011 at 07:38:59PM +0530, Anitha Boyapati wrote:
>> > On Wed, May 11, 2011 at 12:50:31PM +0530, Abnikant Singh wrote:
>> >> ? .text_os ALIGN(8) :
>> >
>> > This says to set the address of the output section .text_os. ?When you
>> > set the address, any input section alignment is ignored. ?This happens
>>
>> I agree that ALIGN() overrides input section alignment. But if we set
>> address for VMA using ALIGN(), should it affect LMA too? I think it
>> should not.
>
> That would be inconsistent.
OK. The reason why I raised this point is because of the inconsistency
observed in one of the cases. Either VMA should equal LMA or LMA
should follow input section's alignment. But none of this happens
(explained below)
> ?If you specify an address for an output
> section it most certainly should affect both VMA and LMA. ?After all,
> LMA is equal to VMA in the usual case. ?I see no reason whatsoever to
> treat an address that happens to use ALIGN any differently from any
> other address.
In such a case I would like to point out 2 issues which may or may
not be related to the patch:
Case 1
======
In the case where ALIGN() is set for VMA but not for LMA, we can
observe that LMA is not equal to VMA. Taking the initial example
again, VMA of .text_os is 0x80000008 while LMA is 0x80000002. LMA is
neither equal to VMA nor is following input section's alignment. This
is a bug.
.text_os ALIGN(8):
.text_os ? ? ? ? ?00000008 ?80000008 ?80000002 ?00000408 ?2**3
? ? ? ? ? ? ? ? ? ? ? ? ? ?CONTENTS, ALLOC, LOAD, READONLY, CODE
Case 2
======
In the case where ALIGN() is set for LMA but not for VMA, the output
behavior is as you mentioned - LMA and VMA are both equal. This is
probably ok.
.text_os : ALIGN(8)
.text_os ? ? ? ? ?00000008 ?80000008 ?80000008 ?00000408 ?2**3
? ? ? ? ? ? ? ? ? ? ? ? ? ?CONTENTS, ALLOC, LOAD, READONLY, CODE
Here both VMA and LMA are 0x80000008
There is an inconsistency in the output between case 1 and case 2.
Only one of these can be right. (And I am assuming case 2 is correct
and case 1 is buggy. Let me know otherwise).
Anitha
>
> --
> Alan Modra
> Australia Development Lab, IBM
>