From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16820 invoked by alias); 4 Jun 2005 13:45:37 -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 16791 invoked by uid 22791); 4 Jun 2005 13:45:32 -0000 Received: from sccrmhc14.comcast.net (HELO sccrmhc14.comcast.net) (204.127.202.59) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Sat, 04 Jun 2005 13:45:32 +0000 Received: from lucon.org ([24.6.212.230]) by comcast.net (sccrmhc14) with ESMTP id <2005060413453101400dmh5le>; Sat, 4 Jun 2005 13:45:31 +0000 Received: by lucon.org (Postfix, from userid 1000) id BF98364607; Sat, 4 Jun 2005 06:45:30 -0700 (PDT) Date: Sat, 04 Jun 2005 13:45:00 -0000 From: "H. J. Lu" To: binutils@sources.redhat.com Subject: Re: PATCH: PR 992: regression: ld selective1 and selective2 fails, cris-elf Message-ID: <20050604134530.GA3137@lucon.org> References: <20050604063551.GA16809@lucon.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050604063551.GA16809@lucon.org> User-Agent: Mutt/1.4.1i X-SW-Source: 2005-06/txt/msg00070.txt.bz2 On Fri, Jun 03, 2005 at 11:35:51PM -0700, H. J. Lu wrote: > The updated patch of > > http://sourceware.org/ml/binutils/2005-06/msg00030.html > > should also fix PR 992. > > We need to check if the current section isn't abs section before settig SEC_KEEP. H.J. --- 2005-06-04 H.J. Lu PR 992 * ldexp.c (exp_mark_used_section): Set SEC_KEEP on current section for etree_assign, etree_provide and etree_provided. Call fold_binary on etree_binary. * ldlang.c (lang_mark_used_section_1): Handle load base. --- ld/ldexp.c.base 2005-06-04 06:35:03.000000000 -0700 +++ ld/ldexp.c 2005-06-04 06:40:59.000000000 -0700 @@ -1237,6 +1237,8 @@ align_n (bfd_vma value, bfd_vma align) void exp_mark_used_section (etree_type *tree, asection *current_section) { + bfd_vma dot = 0; + switch (tree->type.node_class) { case etree_value: @@ -1252,6 +1254,8 @@ exp_mark_used_section (etree_type *tree, break; case etree_binary: + fold_binary (tree, current_section, lang_allocating_phase_enum, + dot, &dot, TRUE); break; case etree_trinary: @@ -1263,12 +1267,13 @@ exp_mark_used_section (etree_type *tree, if (tree->assign.dst[0] != '.' || tree->assign.dst[1] != 0) { etree_value_type result; - bfd_vma dot = 0; result = exp_fold_tree_1 (tree->assign.src, current_section, lang_allocating_phase_enum, dot, &dot, TRUE); + if (current_section != bfd_abs_section_ptr) + current_section->flags |= SEC_KEEP; if (result.valid_p) { bfd_boolean create; --- ld/ldlang.c.base 2005-06-04 06:35:03.000000000 -0700 +++ ld/ldlang.c 2005-06-04 06:36:31.000000000 -0700 @@ -3065,7 +3065,12 @@ lang_mark_used_section_1 os = &(s->output_section_statement); if (os->bfd_section != NULL) - lang_mark_used_section_1 (os->children.head, os); + { + lang_mark_used_section_1 (os->children.head, os); + if (os->load_base) + exp_mark_used_section (os->load_base, + bfd_abs_section_ptr); + } } break; case lang_wild_statement_enum: