From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26905 invoked by alias); 26 Sep 2005 22:36:13 -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 26882 invoked by uid 22791); 26 Sep 2005 22:36:04 -0000 Received: from smtp104.sbc.mail.mud.yahoo.com (HELO smtp104.sbc.mail.mud.yahoo.com) (68.142.198.203) by sourceware.org (qpsmtpd/0.30-dev) with SMTP; Mon, 26 Sep 2005 22:36:04 +0000 Received: (qmail 49692 invoked from network); 26 Sep 2005 22:36:02 -0000 Received: from unknown (HELO lucon.org) (hjjean@sbcglobal.net@67.122.69.173 with login) by smtp104.sbc.mail.mud.yahoo.com with SMTP; 26 Sep 2005 22:36:02 -0000 Received: by lucon.org (Postfix, from userid 1000) id 5CA3F653D8; Mon, 26 Sep 2005 15:36:01 -0700 (PDT) Date: Tue, 27 Sep 2005 01:19:00 -0000 From: "H. J. Lu" To: binutils@sources.redhat.com Cc: amodra@bigpond.net.au Subject: PATCH: Fix empty sections with alignment Message-ID: <20050926223601.GA28885@lucon.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i X-SW-Source: 2005-09/txt/msg00288.txt.bz2 This patch http://sourceware.org/ml/binutils/2005-09/msg00215.html breaks empty sections with alignment. The patch here works for me. H.J. ---- 2005-09-26 H.J. Lu * ldlang.c (lang_size_sections_1): Process alignment addr_tree later. --- ld/ldlang.c.empty 2005-09-26 13:12:55.000000000 -0700 +++ ld/ldlang.c 2005-09-26 15:21:08.000000000 -0700 @@ -4044,7 +4044,9 @@ lang_size_sections_1 lang_output_section_statement_type *os; os = &s->output_section_statement; - if (os->addr_tree != NULL) + if (os->addr_tree != NULL + && !(os->addr_tree->type.node_class == etree_unary + && os->addr_tree->type.node_code == ALIGN_K)) { os->processed = FALSE; exp_fold_tree (os->addr_tree, bfd_abs_section_ptr, &dot); @@ -4159,6 +4161,22 @@ lang_size_sections_1 os->name, (unsigned long) (newdot - savedot)); } } + else if (os->addr_tree->type.node_class == etree_unary + && os->addr_tree->type.node_code == ALIGN_K) + { + newdot = dot; + os->processed = FALSE; + exp_fold_tree (os->addr_tree, bfd_abs_section_ptr, + &newdot); + + 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. */