From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 478 invoked by alias); 19 Sep 2005 02:55:12 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 375 invoked by uid 22791); 19 Sep 2005 02:55:07 -0000 Received: from omta05ps.mx.bigpond.com (HELO omta05ps.mx.bigpond.com) (144.140.83.195) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Mon, 19 Sep 2005 02:55:07 +0000 Received: from grove.modra.org ([144.136.167.90]) by omta05ps.mx.bigpond.com with ESMTP id <20050919025503.HGTR1454.omta05ps.mx.bigpond.com@grove.modra.org> for ; Mon, 19 Sep 2005 02:55:03 +0000 Received: by bubble.grove.modra.org (Postfix, from userid 500) id 929CD1190D8; Mon, 19 Sep 2005 12:25:03 +0930 (CST) Date: Mon, 19 Sep 2005 07:44:00 -0000 From: Alan Modra To: Andrew Lunn Cc: binutils@sources.redhat.com Subject: Re: Change in .ld syntax or a bug? Message-ID: <20050919025503.GV18783@bubble.grove.modra.org> Mail-Followup-To: Andrew Lunn , binutils@sources.redhat.com References: <20050915121708.GO11369@donkey.ma.tech.ascom.ch> <20050915132026.GR18783@bubble.grove.modra.org> <20050915133322.GQ11369@donkey.ma.tech.ascom.ch> <20050916022647.GT18783@bubble.grove.modra.org> <20050916073239.GS11369@donkey.ma.tech.ascom.ch> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050916073239.GS11369@donkey.ma.tech.ascom.ch> User-Agent: Mutt/1.4i X-SW-Source: 2005-09/txt/msg00205.txt.bz2 On Fri, Sep 16, 2005 at 09:32:39AM +0200, Andrew Lunn wrote: > On Fri, Sep 16, 2005 at 11:56:47AM +0930, Alan Modra wrote: > > On Thu, Sep 15, 2005 at 03:33:22PM +0200, Andrew Lunn wrote: > > > So it looks like ld cannot correctly follow on from an empty section. > > > > Would you mind checking whether mainline CVS has this bug? If you find > > it does, I'll see about fixing the problem. > > I just tried anoncvs trunk and it has the same problem. Please let me know whether this cures the problem. * ldlang.c (lang_size_sections_1): Process addr_tree earlier, so that unused output section statements affect dot. Index: ld/ldlang.c =================================================================== RCS file: /cvs/src/src/ld/ldlang.c,v retrieving revision 1.195 diff -u -p -r1.195 ldlang.c --- ld/ldlang.c 4 Aug 2005 06:22:12 -0000 1.195 +++ ld/ldlang.c 19 Sep 2005 02:36:44 -0000 @@ -3973,10 +3973,30 @@ lang_size_sections_1 bfd_vma newdot, after; lang_output_section_statement_type *os; + newdot = dot; os = &s->output_section_statement; + if (os->addr_tree != NULL) + { + os->processed = -1; + exp_fold_tree (os->addr_tree, bfd_abs_section_ptr, + &newdot); + os->processed = 0; + + if (!expld.result.valid_p + && expld.phase != lang_mark_phase_enum) + einfo (_("%F%S: non constant or forward reference" + " address expression for section %s\n"), + os->name); + + newdot = expld.result.value + expld.result.section->vma; + } + if (os->bfd_section == NULL) - /* This section was removed or never actually created. */ - break; + { + /* This section was removed or never actually created. */ + dot = newdot; + break; + } /* If this is a COFF shared library section, use the size and address from the input section. FIXME: This is COFF @@ -4074,22 +4094,6 @@ lang_size_sections_1 os->name, (unsigned long) (newdot - savedot)); } } - else - { - newdot = dot; - os->processed = -1; - exp_fold_tree (os->addr_tree, bfd_abs_section_ptr, - &newdot); - os->processed = 0; - - if (!expld.result.valid_p - && expld.phase != lang_mark_phase_enum) - einfo (_("%F%S: non constant or forward reference" - " address expression for section %s\n"), - os->name); - - newdot = expld.result.value + expld.result.section->vma; - } /* The section starts here. First, align to what the section needs. */ -- Alan Modra IBM OzLabs - Linux Technology Centre