From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12035 invoked by alias); 20 Apr 2011 19:40:11 -0000 Received: (qmail 11934 invoked by uid 22791); 20 Apr 2011 19:40:10 -0000 X-SWARE-Spam-Status: No, hits=-0.7 required=5.0 tests=AWL,BAYES_40,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-wy0-f169.google.com (HELO mail-wy0-f169.google.com) (74.125.82.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 20 Apr 2011 19:39:55 +0000 Received: by wyf19 with SMTP id 19so1065257wyf.0 for ; Wed, 20 Apr 2011 12:39:54 -0700 (PDT) Received: by 10.216.65.142 with SMTP id f14mr473931wed.2.1303328394115; Wed, 20 Apr 2011 12:39:54 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.30.67 with HTTP; Wed, 20 Apr 2011 12:39:34 -0700 (PDT) In-Reply-To: References: From: Anitha Boyapati Date: Wed, 20 Apr 2011 19:40:00 -0000 Message-ID: Subject: Re: VMA and LMA calculation when section alignment is non null To: binutils@sourceware.org Cc: Anitha Boyapati Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2011-04/txt/msg00299.txt.bz2 On 20 April 2011 23:57, Anitha Boyapati wrote: > > > Hi, > > I would like know more about LMA/VMA calculations.=A0 Here is a small lin= ker script (trimmed to relevant portions) > > =A0MEMORY > { > =A0=A0=A0 FLASH (rxai!w) : ORIGIN =3D 0x80000000, LENGTH =3D 512K > } > SECTIONS > { > =A0 .mysec1_os=A0=A0=A0=A0=A0=A0=A0=A0=A0 : > =A0 { > =A0=A0=A0 *(.mysec1) > =A0 } >FLASH AT>FLASH > =A0 .text_os=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 : > =A0 { > =A0=A0=A0 *(.text .text.* ) > =A0 } > FLASH AT>FLASH > } > > It turns out that for some small application which uses .balign 8, the VM= A 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 cacula= ted 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_alignme= nt ? The values are different (It is=A03 for former and -1 for latter). Ple= ase help. > ... > =A0if (os->section_alignment !=3D -1) > =A0=A0 lma =3D 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 th= at 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