From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18047 invoked by alias); 13 Aug 2012 16:11:30 -0000 Received: (qmail 18036 invoked by uid 22791); 13 Aug 2012 16:11:28 -0000 X-SWARE-Spam-Status: No, hits=-5.7 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-yx0-f169.google.com (HELO mail-yx0-f169.google.com) (209.85.213.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 13 Aug 2012 16:11:05 +0000 Received: by yenl1 with SMTP id l1so3664440yen.0 for ; Mon, 13 Aug 2012 09:11:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:x-system-of-record:x-gm-message-state; bh=0SLfRkWr3gHEa2c3NucoAeHodnpl+/lYJk5gytjbu7o=; b=lPtOXipKdx3jaYLkUXin+JWkYKmnJGoGSPSM5MyoFPzP/du9jrOKClaoR5aBuE0wOC eQoJHZuAGwUNto2aIwimmjF0G3Z9+ftK8ZYaIw52UQrVXpnvilr2vL8I5upwAixaNW6d VGjnlnPoMWg9d7zTplj/lBUMAXNuzMyc6GoNVlCljutemi1VIFBthHVe3GJSSDFsf00N q5GBqdMsrfIh2s4v/89opQc6y0fMg+1bz3Op6wCLlP+aMpL1zliNmrdLIpqn4nVPnz3d LyKUcS8Mkc4SLBihhcgk5mpPE1dirSTCCJz7n6FpT0QNY4muEzTLlP1f9Hs6W/U/7RjU N/dw== Received: by 10.66.87.138 with SMTP id ay10mr25690570pab.38.1344874264034; Mon, 13 Aug 2012 09:11:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.66.87.138 with SMTP id ay10mr25690561pab.38.1344874263894; Mon, 13 Aug 2012 09:11:03 -0700 (PDT) Received: by 10.68.8.9 with HTTP; Mon, 13 Aug 2012 09:11:03 -0700 (PDT) In-Reply-To: <20120813142344.GC3947@bubble.grove.modra.org> References: <20120813142344.GC3947@bubble.grove.modra.org> Date: Mon, 13 Aug 2012 18:11:00 -0000 Message-ID: Subject: Re: [GOLD] mapping input to output sections From: Ian Lance Taylor To: binutils@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 X-System-Of-Record: true X-Gm-Message-State: ALoCoQmpwczlvdm2vNGNAJN/UcdBGaVa8PQyxFWle4lPpXDh6+1WyYpRo0s2hThgHQrGJLixmOB6zyFLJX2xyNsintbUKuHG6Krop17hZJyFe2ccUDkfthUlt5ykcQUG0B8fRjvV2TaZLUJJOOvhTm68aucTFAnii9ocqaO334x5wA2CzrYKaXg28WxjsSCX+8c7UzgV5f/V 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: 2012-08/txt/msg00236.txt.bz2 On Mon, Aug 13, 2012 at 7:23 AM, Alan Modra wrote: > Powerpc64 needs to map input .toc and .got sections to the output .got > section, as the following accomplishes with GNU ld: > .got : ALIGN(8) { *(.got .toc) } > I gather gold is supposed to operate without a linker script. Is is > reasonable to move section_name_mapping[], section_name_mapping_count, > output_section_name() and match_file_name() from layout.cc to > target.cc so output_section_name() can be overridden in class > Target_powerpc? Or is there a better way to do this sort of trick? This is a case where I think I would prefer to see a more targeted target hook. Suppose we have Layout::output_section_name call a target hook first. If the hook returns non-NULL, Layout::output_section can return that. Otherwise it can apply the default. > + { > + Target* target = const_cast(¶meters->target()); > + name = target->output_section_name(relobj, name, &len); Seems like the Target::output_section_name method, however it is written, should be const, and this should parameters->target().output_section_name(...) There should be no need for a const_cast here. Ian