Strange LMA/VMA behavior with regions

Anitha Boyapati anitha.boyapati@gmail.com
Thu May 12 14:09:00 GMT 2011


> 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.

To illustrate further, I'll  use the initial output presented in the
previous post. Please refer to the row of section [ 1] .text_os.

Sections:
Idx Name             Size      VMA       LMA       File off  Algn
 0 .mysec1_os    00000002  80000000  80000000  00000400  2**0
                           CONTENTS, ALLOC, LOAD, READONLY, CODE
 1 .text_os          00000008  80000008  80000002  00000408  2**3
                           CONTENTS, ALLOC, LOAD, READONLY, CODE

Here  the value of LMA ( 0x80000002) is not 8-aligned.  The section
.text_os is described in linker script as:

.text_os ALIGN(8) :
 {
   *(.text .text.* )
 ...

Note that address of LMA is not set explicitly. In such a scenario it
is a little
counter-intuitive to see LMA not following input section's alignment
(2**3 in this case) although no ALIGN() or AT() have been used. Looks
like a bug to me.  Please let me know the reason if otherwise.

-- Anitha

(I was not subscribed to ML, so the conversation was copied from
archives. Formatting issues might turn up. Please excuse)



More information about the Binutils mailing list