From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26732 invoked by alias); 10 Feb 2011 01:16:58 -0000 Received: (qmail 26686 invoked by uid 22791); 10 Feb 2011 01:16:55 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_PASS,T_RP_MATCHES_RCVD,T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.44.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 10 Feb 2011 01:16:47 +0000 Received: from kpbe15.cbf.corp.google.com (kpbe15.cbf.corp.google.com [172.25.105.79]) by smtp-out.google.com with ESMTP id p1A1GjoT021380 for ; Wed, 9 Feb 2011 17:16:45 -0800 Received: from iwb12 (iwb12.prod.google.com [10.241.65.76]) by kpbe15.cbf.corp.google.com with ESMTP id p1A1GQ3s027814 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Wed, 9 Feb 2011 17:16:44 -0800 Received: by iwb12 with SMTP id 12so758861iwb.10 for ; Wed, 09 Feb 2011 17:16:44 -0800 (PST) Received: by 10.42.1.133 with SMTP id 5mr3067474icg.239.1297300604568; Wed, 09 Feb 2011 17:16:44 -0800 (PST) Received: from coign.google.com ([67.218.104.194]) by mx.google.com with ESMTPS id i16sm714124ibl.0.2011.02.09.17.16.42 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 09 Feb 2011 17:16:44 -0800 (PST) From: Ian Lance Taylor To: binutils@sourceware.org Subject: gold patch committed: Fix race condition Date: Thu, 10 Feb 2011 01:16:00 -0000 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-System-Of-Record: true 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: 2011-02/txt/msg00090.txt.bz2 --=-=-= Content-length: 990 Until now gold released local symbol information after doing all relocations. However, when I added support for STT_GNU_IFUNC, it became possible for there to be an IRELATIVE relocation referring to the value of a local symbol, which requires the value of the local symbol when writing out the relocation. That was not a problem in the normal unthreaded mode, because the relocations would be written out before the local values were discarded. When threading, though, there is no required ordering between these operations, so it was possible for gold to attempt to fetch the local symbol value after it had been released, leading to an assertion failure. Ths patch fixes the problem by simply not freeing the local symbol information. Committed to mainline and 2.21 branch. Ian 2011-02-09 Ian Lance Taylor PR gold/12316 * object.h (class Sized_relobj): Remove clear_local_symbols. * reloc.cc (Sized_relobj::do_relocate): Don't call clear_local_symbols. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=foo.patch Content-Description: patch Content-length: 1870 Index: object.h =================================================================== RCS file: /cvs/src/src/gold/object.h,v retrieving revision 1.104 diff -u -r1.104 object.h --- object.h 14 Dec 2010 19:03:30 -0000 1.104 +++ object.h 10 Feb 2011 01:11:03 -0000 @@ -1,6 +1,6 @@ // object.h -- support for an object file for linking in gold -*- C++ -*- -// Copyright 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +// Copyright 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. // Written by Ian Lance Taylor . // This file is part of gold. @@ -2165,15 +2165,6 @@ Output_symtab_xindex*, Output_symtab_xindex*); - // Clear the local symbol information. - void - clear_local_symbols() - { - this->local_values_.clear(); - this->local_got_offsets_.clear(); - this->local_plt_offsets_.clear(); - } - // Record a mapping from discarded section SHNDX to the corresponding // kept section. void Index: reloc.cc =================================================================== RCS file: /cvs/src/src/gold/reloc.cc,v retrieving revision 1.62 diff -u -r1.62 reloc.cc --- reloc.cc 14 Dec 2010 19:03:30 -0000 1.62 +++ reloc.cc 10 Feb 2011 01:11:03 -0000 @@ -1,6 +1,6 @@ // reloc.cc -- relocate input files for gold. -// Copyright 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +// Copyright 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. // Written by Ian Lance Taylor . // This file is part of gold. @@ -685,9 +685,6 @@ // Write out the local symbols. this->write_local_symbols(of, layout->sympool(), layout->dynpool(), layout->symtab_xindex(), layout->dynsym_xindex()); - - // We should no longer need the local symbol values. - this->clear_local_symbols(); } // Sort a Read_multiple vector by file offset. --=-=-=--