From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24540 invoked by alias); 11 May 2011 07:20:48 -0000 Received: (qmail 24530 invoked by uid 22791); 11 May 2011 07:20:46 -0000 X-SWARE-Spam-Status: No, hits=2.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,TW_BJ X-Spam-Check-By: sourceware.org Received: from mail-vw0-f41.google.com (HELO mail-vw0-f41.google.com) (209.85.212.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 11 May 2011 07:20:32 +0000 Received: by vws4 with SMTP id 4so191108vws.0 for ; Wed, 11 May 2011 00:20:32 -0700 (PDT) MIME-Version: 1.0 Received: by 10.52.100.163 with SMTP id ez3mr2468953vdb.150.1305098431938; Wed, 11 May 2011 00:20:31 -0700 (PDT) Received: by 10.220.199.71 with HTTP; Wed, 11 May 2011 00:20:31 -0700 (PDT) Date: Wed, 11 May 2011 07:20:00 -0000 Message-ID: Subject: Re: Strange LMA/VMA behavior with regions From: Abnikant Singh To: Alan Modra Cc: binutils@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes 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-05/txt/msg00133.txt.bz2 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