From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 71428 invoked by alias); 15 Oct 2017 13:17:02 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 71416 invoked by uid 89); 15 Oct 2017 13:17:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.4 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-pf0-f179.google.com Received: from mail-pf0-f179.google.com (HELO mail-pf0-f179.google.com) (209.85.192.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 15 Oct 2017 13:17:01 +0000 Received: by mail-pf0-f179.google.com with SMTP id b79so13828092pfk.5 for ; Sun, 15 Oct 2017 06:17:01 -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:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=ufR3WQjZIo5oUoae/BLs10bgv1v5iwq7B05BRKATxEM=; b=H0ORKpsInRCw3aBStLlSrNeh07NSPLJ9ppqKHM86wzE9n4yeshKAhDNl+SnjVjRF3q TFgYFsqv2FrPuo/nG2o16HuP1daiHz7UJ1wwpP8Rg0YFdLdidinUMswNG1BHoDDrrTs8 w7Gjf++SIlAdcprsPERG2WQKBZY4l/u/hLAmXnMjHTCc9a6pnxKEZCjAOIGYqwOz4RVU RAVT1GXjvZV+l09OTFO1WyZCB+gGlxAmuQWakuRHWqhEmoUeStfOeUrK4s0YoxcOgFxO XpijOzvGDsjEzdacROHatjGmyfmaboUtfw5Z5ZnM63FJF58Ibicpur0ZhIGYpfN84ihR mtFg== X-Gm-Message-State: AMCzsaXpSLO8fR9cvcX+0eJQ8Cvs5smZAIsQfIJtpbpS3vo6Jd+aF9JL m+F8qQmToN9IrIZBJI7ILxmOiw== X-Google-Smtp-Source: AOwi7QC+BOmjXWtVFGCkwBGMGfLjQx2oYXb6doQtqLksC3esJId6k+qnp37993/z/SSN4zJHNXTwRQ== X-Received: by 10.84.132.129 with SMTP id e1mr6328145ple.444.1508073419293; Sun, 15 Oct 2017 06:16:59 -0700 (PDT) Received: from gnu-tools-1.localdomain (c-73-93-86-59.hsd1.ca.comcast.net. [73.93.86.59]) by smtp.gmail.com with ESMTPSA id r78sm12190887pfb.29.2017.10.15.06.16.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 15 Oct 2017 06:16:58 -0700 (PDT) Received: by gnu-tools-1.localdomain (Postfix, from userid 1000) id 35EEC1C0385; Sun, 15 Oct 2017 06:16:57 -0700 (PDT) Date: Sun, 15 Oct 2017 18:09:00 -0000 From: "H.J. Lu" To: gcc-patches@gcc.gnu.org Cc: Joseph Myers Subject: [PATCH] Use Pcrt1.o%s/gPcrt1.o%s for -static-pie Message-ID: <20171015131657.GA24340@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.8.3 (2017-05-23) X-IsSubscribed: yes X-SW-Source: 2017-10/txt/msg00955.txt.bz2 crt1.o is used to create dynamic and non-PIE static executables. Static PIE needs to link with Pcrt1.o, instead of crt1.o, to relocate static PIE at run-time. When -pg is used with -static-pie, gPcrt1.o should be used. Tested on x86-64. OK for master? Thanks. H.J. --- * config/gnu-user.h (GNU_USER_TARGET_STARTFILE_SPEC): Use Pcrt1.o%s/gPcrt1.o%s for -static-pie. --- gcc/config/gnu-user.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h index a967b69a350..c1cfdc3da90 100644 --- a/gcc/config/gnu-user.h +++ b/gcc/config/gnu-user.h @@ -51,9 +51,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #if defined HAVE_LD_PIE #define GNU_USER_TARGET_STARTFILE_SPEC \ "%{shared:; \ - pg|p|profile:gcrt1.o%s; \ + pg|p|profile:%{static-pie:gPcrt1.o%s;:gcrt1.o%s}; \ static:crt1.o%s; \ - static-pie|" PIE_SPEC ":Scrt1.o%s; \ + static-pie:Pcrt1.o%s; \ + " PIE_SPEC ":Scrt1.o%s; \ :crt1.o%s} \ crti.o%s \ %{static:crtbeginT.o%s; \ -- 2.13.5