From patchwork Fri Sep 29 23:29:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 23262 Received: (qmail 32446 invoked by alias); 29 Sep 2017 23:29:36 -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 32104 invoked by uid 89); 29 Sep 2017 23:29:35 -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, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-oi0-f68.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=v1IUVHtVC204zPlArhJMUwwW2KKma/yFhc3jlK/A7c8=; b=W+wzKKwJSQ9yU3nLJFq6FNpYalrYLw5qmRm9Lpwsn941hYBsAXEpQcD5+ekiivLJ10 asb+Og0m9g+g47wNoUXOrXvLG5TJJfoTUEub6CsVAbPlxILG+b0GelUL4YYTT2XjQHA6 kfy5pjbBPF2dEaVJKB555LDIfmD/OSmWNE56zwDqRTsvczCg18D3JJX+nL5tmI+g6V0y GjF7PWn5i4VNb7xdEXXcQOdPM7OXMu95mnztGIVZQmHnWJZ9Yn8J4cz8JlIBsCM4P4o2 duKnMt+0tICDHrLmAe2RTzg4bP8O5dhlZQe+o1jpcoNMwY7mwSnwOXd5GkppWYeWaMUH bkMQ== X-Gm-Message-State: AMCzsaXPiQXcuyGIaCa+WdRZq6XIxbmwhfXWNYsPeGOpcGhStXkq/axB Jzb8DbSRP9KtIc8EGV0NwcXMfwHGAHGlw1hKia4= X-Google-Smtp-Source: AOwi7QBUgsyzCRS0IDMuw1oHFAaWA+08ADMZZgVPvfIM//6c0bA2dcWrqGvHhLmgB8TNf5slIDHq/JNTPNFsFYzDunA= X-Received: by 10.157.10.129 with SMTP id 1mr3687789otq.201.1506727772606; Fri, 29 Sep 2017 16:29:32 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20170929231735.GL25070@bubble.grove.modra.org> References: <20170929213400.GL2482@gmail.com> <20170929231735.GL25070@bubble.grove.modra.org> From: "H.J. Lu" Date: Fri, 29 Sep 2017 16:29:30 -0700 Message-ID: Subject: Re: [PATCH] powerpc: Update elf_machine_load_address for static PIE To: Alan Modra Cc: GNU C Library On 9/29/17, Alan Modra wrote: > On Fri, Sep 29, 2017 at 02:34:00PM -0700, H.J. Lu wrote: >> powerpc uses _DYNAMIC to compute load address, which works with static >> PIE. We just need to return 0 if _DYNAMIC is undefined for static >> executable. > > powerpc does, but powerpc64 does not. So why is the test necessary on > powerpc64? > You are right. Here is the updated patch for powerpc32. OK for master? Thanks. H.J. From 077b614369ee19dd5cc798181d0c936f98497390 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Thu, 28 Sep 2017 14:51:41 -0700 Subject: [PATCH] powerpc32: Update elf_machine_load_address for static PIE powerpc32 uses _DYNAMIC to compute load address, which works with static PIE. We just need to return 0 if _DYNAMIC is undefined for static executable. * sysdeps/powerpc/powerpc32/dl-machine.h (elf_machine_load_address): Return 0 if _DYNAMIC is undefined for static executable. --- sysdeps/powerpc/powerpc32/dl-machine.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sysdeps/powerpc/powerpc32/dl-machine.h b/sysdeps/powerpc/powerpc32/dl-machine.h index 1f8437ed9c..9cf876e136 100644 --- a/sysdeps/powerpc/powerpc32/dl-machine.h +++ b/sysdeps/powerpc/powerpc32/dl-machine.h @@ -64,6 +64,11 @@ elf_machine_dynamic (void) static inline Elf32_Addr __attribute__ ((const)) elf_machine_load_address (void) { +#ifndef SHARED + extern Elf32_Dyn _DYNAMIC[] __attribute__((weak, visibility ("hidden"))); + if (!_DYNAMIC) + return 0; +#endif Elf32_Addr *branchaddr; Elf32_Addr runtime_dynamic; -- 2.13.6