From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27118 invoked by alias); 22 Apr 2010 01:11:25 -0000 Received: (qmail 27019 invoked by uid 22791); 22 Apr 2010 01:11:23 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mail-gx0-f214.google.com (HELO mail-gx0-f214.google.com) (209.85.217.214) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 22 Apr 2010 01:11:16 +0000 Received: by gxk6 with SMTP id 6so1062633gxk.14 for ; Wed, 21 Apr 2010 18:11:14 -0700 (PDT) Received: by 10.100.50.5 with SMTP id x5mr995953anx.148.1271898674273; Wed, 21 Apr 2010 18:11:14 -0700 (PDT) Received: from bubble.grove.modra.org ([115.187.252.19]) by mx.google.com with ESMTPS id 30sm73398026anp.1.2010.04.21.18.11.12 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 21 Apr 2010 18:11:13 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 6C99E170C2B5; Thu, 22 Apr 2010 10:41:06 +0930 (CST) Date: Thu, 22 Apr 2010 01:11:00 -0000 From: Alan Modra To: David Stubbs Cc: binutils@sourceware.org Subject: Re: VMA section overlap warnings for overlays Message-ID: <20100422011106.GI3510@bubble.grove.modra.org> Mail-Followup-To: David Stubbs , binutils@sourceware.org References: <4D60B0700D1DB54A8C0C6E9BE69163700E67DFD1@EXCHANGEVS.IceraSemi.local> <20100421082441.GG3510@bubble.grove.modra.org> <4D60B0700D1DB54A8C0C6E9BE69163700E7815C7@EXCHANGEVS.IceraSemi.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4D60B0700D1DB54A8C0C6E9BE69163700E7815C7@EXCHANGEVS.IceraSemi.local> User-Agent: Mutt/1.5.20 (2009-06-14) 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: 2010-04/txt/msg00303.txt.bz2 On Wed, Apr 21, 2010 at 03:44:08PM +0100, David Stubbs wrote: > .imem 0x2000 : AT (LOADADDR (.text) + SIZEOF (.text)) > { > *(.imem) > } :imem So this goes to imem with a vma of 0x2000 and lma x, say > .overlay1 ALIGN (ADDR (.imem) + SIZEOF (.imem), 8K) > : AT (LOADADDR (.imem) + SIZEOF (.imem)) > { > *(.overlay.1) > } :imem and this to imem with vma 0x4000 and lma x+1 Now we have a problem. If we put .overlay1 in imem at p_offset+1 then the execution model lma (calculated from p_paddr+p_offset+1) for .overlay1 will be correct, but the vma (from p_vaddr+p_offset+1 ie. 0x2001) will be wrong. Of course, with multiple overlays packed into one header you can't possibly get the execution model vma correct for all the overlays, so you probably don't care. However, the ELF_IS_SECTION_IN_SEGMENT_FILE test in elf.c:assign_file_positions_for_load_sections fails, which is why you get a linker error. Conversely, putting .overlay1 at p_offset+0x2000 will give the correct vma but the wrong lma, and of course insert a whole lot of padding. This is what Jan's patch did, and is quite wrong for overlays.. -- Alan Modra Australia Development Lab, IBM