From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22850 invoked by alias); 17 Aug 2016 14:54:11 -0000 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 Received: (qmail 22837 invoked by uid 89); 17 Aug 2016 14:54:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=UD:am, Makefileam, makefile.am, UD:Makefile.am X-HELO: mail-qk0-f173.google.com Received: from mail-qk0-f173.google.com (HELO mail-qk0-f173.google.com) (209.85.220.173) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 17 Aug 2016 14:54:00 +0000 Received: by mail-qk0-f173.google.com with SMTP id v123so102231857qkh.2 for ; Wed, 17 Aug 2016 07:53:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=stjj9ZUL5xML80qTXnpwnhFWd2o24VxK0sv2lLy5aQc=; b=iDTE1UW/lkBjUNWOdbFy+7F8VVKyBIPzxpC5vmRRz6rlFcF81tCJOJHP9XK/IbIX4b nESkLiSBfUKtL3sCOfyMmb29jTtF6E1fB3GysC429O/GABhyNZinMgu4cbY3BCz6YSHO clklluUEvBeEM0aBvfjEAm+kArbhCy3PkluVwQ5GTgN7NPAkQi8bEiMraHnK0ujaok7p ZUHAiSUtWy68aORWcVAV6IOQAOFYqbzrFKMHiSEz0uT2xRNssnxoGodY6haZs9dl6t8l PrXEQjf4CyN3GBCn3lPo4WD4qRoaQIYpnsFRL26YrN5fwXuqm3Gj+aN7vD7nVb+0zwvd ccxQ== X-Gm-Message-State: AEkoouu1YuWIKRWcaNzQg42cgJDtAFs9jLTpmBDqG3qwZD04Q4yHCBAesexZCI42DnjLSruSeFmSd2VstLXiYg== X-Received: by 10.55.6.137 with SMTP id 131mr46451275qkg.199.1471445638417; Wed, 17 Aug 2016 07:53:58 -0700 (PDT) MIME-Version: 1.0 Received: by 10.55.163.149 with HTTP; Wed, 17 Aug 2016 07:53:57 -0700 (PDT) In-Reply-To: References: From: "H.J. Lu" Date: Wed, 17 Aug 2016 14:54:00 -0000 Message-ID: Subject: Re: [gold commit] PR 20216: Fix extraneous complaints about missing expected TLS relocation To: Cary Coutant Cc: Binutils Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2016-08/txt/msg00119.txt.bz2 On Wed, Aug 10, 2016 at 10:59 AM, Cary Coutant wrote: > With some versions of gas, the call to tls_get_addr uses a GOTPCREL > relocation instead of a GOTPCRELX relocation. We should allow for that > when skip_call_tls_get_addr_ is true. We should also build the test > objects with the in-tree assembler. > > This patch also fixes some cascading error messages caused by not > resetting the skip_call_tls_get_addr_ flag after printing the error. > > -cary > > > 2016-08-10 Cary Coutant > > gold/ > PR gold/20216 > * x86_64.cc (Target_x86_64::Relocate::relocate): Add check for > R_X86_64_GOTPCREL. Reset skip_call_tls_get_addr_ after printing > error message. > * testsuite/Makefile.am (pr20216_gd.o): Add -Bgcctestdir/. > (pr20216_ld.o): Likewise. > * testsuite/Makefile.in: Regenerate. > > diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am > index 39f9e9e..739458c 100644 > --- a/gold/testsuite/Makefile.am > +++ b/gold/testsuite/Makefile.am > @@ -1193,10 +1193,10 @@ pr20216b.so: pr20216_def.o gcctestdir/ld > $(LINK) -Bgcctestdir/ -shared pr20216_def.o > > pr20216_gd.o: pr20216_gd.S > - $(COMPILE) -c -o $@ $< > + $(COMPILE) -Bgcctestdir/ -c -o $@ $< > > pr20216_ld.o: pr20216_ld.S > - $(COMPILE) -c -o $@ $< > + $(COMPILE) -Bgcctestdir/ -c -o $@ $< > > endif DEFAULT_TARGET_X86_64_OR_X32 > > diff --git a/gold/x86_64.cc b/gold/x86_64.cc > index 6aa489a..8d494ea 100644 > --- a/gold/x86_64.cc > +++ b/gold/x86_64.cc > @@ -3505,6 +3505,7 @@ Target_x86_64::Relocate::relocate( > if (this->skip_call_tls_get_addr_) > { > if ((r_type != elfcpp::R_X86_64_PLT32 > + && r_type != elfcpp::R_X86_64_GOTPCREL There are // Convert // callq *foo@GOTPCRELX(%rip) to // addr32 callq foo // and jmpq *foo@GOTPCRELX(%rip) to // jmpq foo // nop template static inline bool can_convert_callq_to_direct(const Symbol* gsym, unsigned int r_type, size_t r_offset, View_type* view) { gold_assert(gsym != NULL); // We cannot do the conversion unless it's a GOTPCRELX relocation. if (r_type != elfcpp::R_X86_64_GOTPCRELX) return false; I don't think checking R_X86_64_GOTPCREL is needed. GCC generates x86-64 TLS code sequences without PLT only if R_X86_64_GOTPCRELX is supported. > && r_type != elfcpp::R_X86_64_GOTPCRELX > && r_type != elfcpp::R_X86_64_PLT32_BND > && r_type != elfcpp::R_X86_64_PC32_BND > @@ -3514,6 +3515,7 @@ Target_x86_64::Relocate::relocate( > { > gold_error_at_location(relinfo, relnum, rela.get_r_offset(), > _("missing expected TLS relocation")); > + this->skip_call_tls_get_addr_ = false; > } > else > { -- H.J.