From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by sourceware.org (Postfix) with ESMTPS id 18917386185D for ; Wed, 23 Sep 2020 22:42:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 18917386185D Received: by mail-pl1-x62e.google.com with SMTP id y17so517648plb.6 for ; Wed, 23 Sep 2020 15:42:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=sy6KxXpdSKqWBTyCq9cciUJW/nYH5lc3dp1CsAbBggQ=; b=qKkcDtWhiYNCmICQM+/R9eo5C1sMXN9eGq8m/S6Y7R5/Zf9sdzab1zVNGwPjy+mZHT 6ccywFVnPZyPgN9Iv7z7vD4pXH9G1h+ZFVslRofVyrymtxEh7IiYjEGznVbNvjlELp1Z FWTRQVAajmi+bxvL9gtR+j1KmtcCWqfzMYRkqQtGXFz3SFKv9d1lDIqpliozOJftB8Qq rcccONTGkfYGDokrxXLpGVTFjScJZZFpSYdF9SZOI4WhEsjp1gKuFH/25uLAXfUnPlS7 N6RjO7rt4PZ8LOPApQWEemBQRf026D69DuO1oI40cUh4sno87oxveBsFcz3whQy2dSMN 1Rew== X-Gm-Message-State: AOAM5334G79z/DiLAaqyHbEOSdyoYo6N7n2KJfAieEYbw9ql6qE1tm0C F35YayTlW1tj5uJb9FxIfemU2a5QKPs= X-Google-Smtp-Source: ABdhPJxBZ23gosYsLKsHRowq15ZoZUYBhgPKhCSYS56O4+uIpaQU3XfhP3DvmdLmoT/3J3Sd7goiUw== X-Received: by 2002:a17:902:bf46:b029:d1:f387:d225 with SMTP id u6-20020a170902bf46b02900d1f387d225mr1757615pls.74.1600900930894; Wed, 23 Sep 2020 15:42:10 -0700 (PDT) Received: from bubble.grove.modra.org (158.106.96.58.static.exetel.com.au. [58.96.106.158]) by smtp.gmail.com with ESMTPSA id o20sm802658pgh.63.2020.09.23.15.42.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Sep 2020 15:42:10 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 18B9585B1A; Thu, 24 Sep 2020 08:12:06 +0930 (ACST) Date: Thu, 24 Sep 2020 08:12:06 +0930 From: Alan Modra To: binutils@sourceware.org Subject: [GOLD] PowerPC64 __tls_get_addr_opt stub Message-ID: <20200923224205.GI5452@bubble.grove.modra.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Sep 2020 22:42:13 -0000 This stub doesn't have the r2 store at the beginning. * powerpc.cc (Target_powerpc::Relocate::relocate): Don't skip first insn of __tls_get_addr_opt stub. diff --git a/gold/powerpc.cc b/gold/powerpc.cc index e35cbcf6c0..1020fa42f9 100644 --- a/gold/powerpc.cc +++ b/gold/powerpc.cc @@ -10401,21 +10401,24 @@ Target_powerpc::Relocate::relocate( value += ent->tocoff_; if (size == 64 && ent->r2save_ - && r_type == elfcpp::R_PPC64_REL24_NOTOC) + && !(gsym != NULL + && target->is_tls_get_addr_opt(gsym))) { - if (!(target->power10_stubs() - && target->power10_stubs_auto())) - value += 4; - } - else if (size == 64 - && ent->r2save_ - && relnum < reloc_count - 1) - { - Reltype next_rela(preloc + reloc_size); - if (elfcpp::elf_r_type(next_rela.get_r_info()) - == elfcpp::R_PPC64_TOCSAVE - && next_rela.get_r_offset() == rela.get_r_offset() + 4) - value += 4; + if (r_type == elfcpp::R_PPC64_REL24_NOTOC) + { + if (!(target->power10_stubs() + && target->power10_stubs_auto())) + value += 4; + } + else if (relnum < reloc_count - 1) + { + Reltype next_rela(preloc + reloc_size); + if (elfcpp::elf_r_type(next_rela.get_r_info()) + == elfcpp::R_PPC64_TOCSAVE + && (next_rela.get_r_offset() + == rela.get_r_offset() + 4)) + value += 4; + } } localentry0 = ent->localentry0_; has_stub_value = true; -- Alan Modra Australia Development Lab, IBM