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: VMA and LMA calculation when section alignment is non null


On 20 April 2011 23:57, Anitha Boyapati <anitha.boyapati@gmail.com> wrote:
>
>
> Hi,
>
> I would like know more about LMA/VMA calculations.? Here is a small linker script (trimmed to relevant portions)
>
> ?MEMORY
> {
> ??? FLASH (rxai!w) : ORIGIN = 0x80000000, LENGTH = 512K
> }
> SECTIONS
> {
> ? .mysec1_os????????? :
> ? {
> ??? *(.mysec1)
> ? } >FLASH AT>FLASH
> ? .text_os?????????? :
> ? {
> ??? *(.text .text.* )
> ? } > FLASH AT>FLASH
> }
>
> It turns out that for some small application which uses .balign 8, the VMA and LMA of .text_os differs. I was debugging this when I hit the function lang_size_sections_1() from ldlang.c. As far as I understand VMA is caculated using os->bfd_section->alignment_power which is then set using bfd_set_section_vma(). This macro sets both lma and vma to some valid value.
>
> Now for lma processing, os->section_alignment is being used. What is the difference between os->bfd_section->alignment_power and os->section_alignment ? The values are different (It is?3 for former and -1 for latter). Please help.
> ...
> ?if (os->section_alignment != -1)
> ?? lma = align_power (lma, os->section_alignment);
> ...

Hi again.

I am glad I found a relevant thread describing the exact problem
I am facing.

http://sourceware.org/ml/binutils/2010-12/msg00477.html

The given patch solves my issue too. (Sorry I havent referred to the
binutils version I am using. It is 2.20.1). Now my next question :
Since the patch was submitted after binutils 2.21 release, I am assuming that
no release of binutils has this patch included.

I would still appreciate anyone letting me know the difference between
os->bfd_section->alignment_power and os->section_alignment

Thanks
Anitha


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