From patchwork Sun Oct 15 13:16:57 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: 826005 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-464230-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="nYx2cAYd"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yFMSB1YkZz9sRV for ; Mon, 16 Oct 2017 00:17:10 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=j75ILOY4x7iwMPrmtMuoD3E6Ymi30zz1he64HHUUTc5qtI5rH9 2ayKQ+5v7QJL3lZXCxetRW354YCmUMLG67xXNnLs8SCIaYQp57g/REIn9prEj/cP 7YDGRn4PDVY0Tg0/Mg1BLimdI/RocwZ5HN2YCsB1iwEQybgoGC1hw0E+g= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=7kz0bEdoPlv8CuGRHJ+pc3KsA/8=; b=nYx2cAYd9HVPI18oMaN9 nLpuvMSrWyXuwuMKwN/fndFXAz4n5QmgZTDKD8/MXm5g5AjrF2CesCFJjEhMMoTj qU3divoUn249dy6I4Cf5JIzb2xlHwRb/Ucm6AcTamK3hwqDOMbFXQKsa/6mQKvhE tVIp4DYboAnQWszz9D2SGOU= 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-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@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 06:16:57 -0700 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-Disposition: inline User-Agent: Mutt/1.8.3 (2017-05-23) X-IsSubscribed: yes 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; \