From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31141 invoked by alias); 27 Jan 2012 22:26:58 -0000 Received: (qmail 31130 invoked by uid 22791); 27 Jan 2012 22:26:57 -0000 X-SWARE-Spam-Status: No, hits=-5.1 required=5.0 tests=AWL,BAYES_00,NO_DNS_FOR_FROM,RCVD_IN_DNSWL_HI,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mga11.intel.com (HELO mga11.intel.com) (192.55.52.93) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 27 Jan 2012 22:26:45 +0000 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 27 Jan 2012 14:26:45 -0800 X-ExtLoop1: 1 Received: from gnu-6.sc.intel.com ([10.3.194.135]) by fmsmga001.fm.intel.com with ESMTP; 27 Jan 2012 14:26:43 -0800 Received: by gnu-6.sc.intel.com (Postfix, from userid 500) id ACDDAC0222; Fri, 27 Jan 2012 14:26:43 -0800 (PST) Date: Fri, 27 Jan 2012 22:26:00 -0000 From: "H.J. Lu" To: binutils@sourceware.org Cc: Cary Coutant , Ian Lance Taylor Subject: [gold] PATCH: Correct relocation offset Message-ID: <20120127222643.GA23840@intel.com> Reply-To: "H.J. Lu" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) 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-01/txt/msg00251.txt.bz2 Hi, The layout of .gnu_incremental_relocs section entry is 4byte: r_type 4byte: out_shndx addr_size: offset addr_size: addend and incremental.cc uses 8 + 2 * parameters->target().get_size() / 8; or 8 + 2 * sizeof_add to compute .gnu_incremental_relocs entry size. However, write_info_blocks uses "3 * sizeof_addr", which only works for 64bit target. This patch fixes it. OK to install? Thanks. H.J. -- 2012-01-27 H.J. Lu * incremental.cc (write_info_blocks): Correct relocation offset. diff --git a/gold/incremental.cc b/gold/incremental.cc index 39bad37..2a26573 100644 --- a/gold/incremental.cc +++ b/gold/incremental.cc @@ -1632,7 +1632,8 @@ Output_section_incremental_inputs::write_info_blocks( Swap32::writeval(pov + 4, shndx); Swap32::writeval(pov + 8, chain); Swap32::writeval(pov + 12, nrelocs); - Swap32::writeval(pov + 16, first_reloc * 3 * sizeof_addr); + Swap32::writeval(pov + 16, + first_reloc * (8 + 2 * sizeof_addr)); pov += 20; }