Strange LMA/VMA behavior with regions

Abnikant Singh abnikant@gmail.com
Wed May 11 07:20:00 GMT 2011


Hi Alan,

 I have tested your patch for LMA/VMA alignment issue on AVR
toolchain.I am facing the following issue when using the ALIGN
dirctive to align
 the VMA. I am linking the following program object files..[1 & 2]

1. asm.s

.section .mysec1, "ax"
nop

.text
  .balign 8
.global _balignfunc
.type _balignfunc, @function

_balignfunc:

  NOP

2. asm2.s

.section .mysec1, "ax"
.global _func
.type _func, @function

_func:

  NOP

The following linker script I am using to link the above programs.

MEMORY
{
    FLASH (rxai!w) : ORIGIN = 0x80000000, LENGTH = 512K
}


SECTIONS
{
  .mysec1_os          :
  {
    *(.mysec1)
  } >FLASH AT>FLASH
  .text_os ALIGN(8) :
  {
    *(.text .text.* )
  } > FLASH AT>FLASH

}

The objdump -h shows the following output:

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

As we can notice the Algn filed shown is 2**3, LMA is not following
the section alignment [which is 80000002]. In asm.s

.balign is 8, which I think should be taken as the input section
alignment and in init_os it should set section alignment as 8.

However if I directly give output section alignment, LMA get the
required alignment i.e. if in the linker script I use
......
.......
  .text_os ALIGN(8) : ALIGN(8)
  {
    *(.text .text.* )
  } > FLASH AT>FLASH

}

I get the following output..

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  80000008  00000408  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, CODE

Please give the inputs...
Is this the expected behavior or am I missing something ?

Regards,
Abnikant



More information about the Binutils mailing list