From patchwork Mon Jul 31 03:50:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 21815 Received: (qmail 40511 invoked by alias); 31 Jul 2017 03:50:33 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 40492 invoked by uid 89); 31 Jul 2017 03:50:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.0 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=H*Ad:D*linux-m68k.org X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-pf0-f173.google.com 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:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=dCOxE/B/J1iim6zS09UFmmK2Hg/vatwgh40RAXaDDDw=; b=pouxIgW4hwP9z5w0pGX65W277cTqZEIoPvAQje+PgFxmxaC7w0U+BVrqPMmpSOUu2+ DodQvBLfdN4Ex5K9m7rM1V35BdIVEwbjUy06x5vLA6MlGz3sgjIo7Oa47RVlV9xtGbZS 1/VgFR8McBUaj+MPp1EiLF/XR8oEAkuE0+L5IL4ju2/Q3lo+5OhvvadeMXraj2R/negv CibIADnw6MVxPVR+VMCFQQzdC/08v4PHW9J/GTRiznRPFhyW+15wl5N4g4a08fzk0EZN 9ugE7iKKl8SsNDhGIt1e7hNqFuzYVdTKVsBvdczUCiRwsTtv/JDOoj9mtJ27aXUVb9DW LA5Q== X-Gm-Message-State: AIVw111jWPpmtcKQkGeNTdvs7borW2vxUwDbaWvh1uvm3GHEjW4lwvvo YMvbj8ifIXUIOWwI X-Received: by 10.84.236.13 with SMTP id q13mr15656508plk.324.1501473029662; Sun, 30 Jul 2017 20:50:29 -0700 (PDT) Date: Mon, 31 Jul 2017 13:20:23 +0930 From: Alan Modra To: Florian Weimer Cc: Andreas Schwab , Carlos O'Donell , Josh Stone , libc-alpha@sourceware.org, binutils@sourceware.org Subject: Re: ppc64le: expected localentry:0 `pthread_condattr_destroy' Message-ID: <20170731035022.GG1956@bubble.grove.modra.org> References: <598f4b24-976e-cc28-177c-4e01e8c7467c@redhat.com> <20170728100759.GB1956@bubble.grove.modra.org> <20170728125210.GD1956@bubble.grove.modra.org> <8c6b1290-31f1-1da6-60d3-9695cad43466@redhat.com> <20170729044418.GE1956@bubble.grove.modra.org> <87r2wyjkak.fsf@linux-m68k.org> <8abaa1cd-b824-f8b8-e89a-a0a3390278f1@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <8abaa1cd-b824-f8b8-e89a-a0a3390278f1@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) This makes ld warn about --plt-localentry if a version of glibc without the necessary ld.so checks is detected, and revises the documentation. bfd/ * elf64-ppc.c (ppc64_elf_tls_setup): Warn on --plt-localentry without ld.so checks. gold/ * powerpc.cc (Target_powerpc::scan_relocs): Warn on --plt-localentry without ld.so checks. ld/ * ld.texinfo (plt-localentry): Revise. diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 5f3c79f..7f4f7b6 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -8372,6 +8372,12 @@ ppc64_elf_tls_setup (struct bfd_link_info *info) --plt-localentry can cause trouble. */ if (htab->params->plt_localentry0 < 0) htab->params->plt_localentry0 = 0; + if (htab->params->plt_localentry0 + && elf_link_hash_lookup (&htab->elf, "GLIBC_2.26", + FALSE, FALSE, FALSE) == NULL) + info->callbacks->einfo + (_("%P: warning: --plt-localentry is especially dangerous without " + "ld.so support to detect ABI violations.\n")); htab->tls_get_addr = ((struct ppc_link_hash_entry *) elf_link_hash_lookup (&htab->elf, ".__tls_get_addr", diff --git a/gold/powerpc.cc b/gold/powerpc.cc index e322d6f..14e56d8 100644 --- a/gold/powerpc.cc +++ b/gold/powerpc.cc @@ -7660,6 +7660,10 @@ Target_powerpc::scan_relocs( { if (parameters->options().user_set_plt_localentry()) plt_localentry0 = parameters->options().plt_localentry(); + if (plt_localentry0 + && symtab->lookup("GLIBC_2.26", NULL) == NULL) + gold_warning(_("--plt-localentry is especially dangerous without " + "ld.so support to detect ABI violations")); } this->plt_localentry0_ = plt_localentry0; this->plt_localentry0_init_ = true; diff --git a/ld/ld.texinfo b/ld/ld.texinfo index 172c1dd..ebe7e7b 100644 --- a/ld/ld.texinfo +++ b/ld/ld.texinfo @@ -7613,8 +7613,11 @@ Such an external function can be called via the PLT without saving r2 or restoring it on return, avoiding a common load-hit-store for small functions. The optimization is attractive, with up to 40% reduction in execution time for a small function, but can result in symbol -interposition failures. Use with care. @option{--no-plt-localentry} -is the default. +interposition failures. Also, minor changes in a shared library, +including system libraries, can cause a function that was localentry:0 +to become localentry:8. This will result in a dynamic loader +complaint and failure to run. The option is experimental, use with +care. @option{--no-plt-localentry} is the default. @end table @ifclear GENERIC