From patchwork Mon Oct 6 23:19:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sriraman Tallam X-Patchwork-Id: 396969 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 38C3314008B for ; Tue, 7 Oct 2014 10:19:54 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; q=dns; s=default; b=jqFr3ZSa8lBvnjyTtf gvLT+6v4xCkrxSdJOxcbKylAdOj+vcHzAy4uVUpkOUny477ZRCkTlSWULX9AE2o0 96XO3n6tJplJ1oiG7RXFzXiUD31T9QDKK7fEy4ntIzLCpuLbFVDnJRMh2Rm6DGgz EeRypE/9vYNOJUB2fG9x1J6/4= 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 :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; s=default; bh=wLodUVoy8z8Vfyz0m5ZOb428 zic=; b=P1CE5GQ6+o4HerHH+CRp9xthNj0TA3dTp1qrRqaoi5iQAhgPlD/Z/QH+ hqBD2y/bdt1HTAXHP3AhKTVy/AHTv36JVYlhDTn1Ji2mii/QEr8gsSLImnAJKjxo ox2ngjFUaYQW95vKqKxqNsqx5/9KYm28epiezzog5gFj7Bm7qHA= Received: (qmail 31372 invoked by alias); 6 Oct 2014 23:19:48 -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 31363 invoked by uid 89); 6 Oct 2014 23:19:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mail-qc0-f171.google.com Received: from mail-qc0-f171.google.com (HELO mail-qc0-f171.google.com) (209.85.216.171) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 06 Oct 2014 23:19:46 +0000 Received: by mail-qc0-f171.google.com with SMTP id i17so4824789qcy.30 for ; Mon, 06 Oct 2014 16:19:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=3/4KKvPsbZsarzbV7Kc4MG42VysHZ2h9m1ZQxEKZtwk=; b=nOiaRZX0EQ8OaMZrdCHcDASvnx2HJCD/+nsxIn26VubHaZ3otlmjX5uAGdNLhk8kau 3aOMvOMufZMY0XfOO0UxUaz/PhL0tW6ECBYeIuAEZ9H46199+qWVr+XsbA8Jltbk4WON MRHQNFWxOnskEE6p57mND4ym36jsHQut86pRAOBG2i4Z5lcJhy4f4u+0wEfMJe01MwfN ruyLNg0OQeOO4MoljEnJRDccYy8Knt63vQIxWVnSRLn16jUFB/Zmp5N5jo1rrzHMEwIa 1cnvX/NeQQTW7Aat82GfJqe7fCUYRYgjcrJMVO/mwVHfJeO6WHTB63YHsw+G2f8hna3+ a1jg== X-Gm-Message-State: ALoCoQnndCgnQt/nHpnt0VfroU5VwdDK5rV7OL5pQ+zg7REZYZ1nsiREFG+YSL47ctrbXDgagUk4 MIME-Version: 1.0 X-Received: by 10.140.39.37 with SMTP id u34mr31872583qgu.36.1412637584313; Mon, 06 Oct 2014 16:19:44 -0700 (PDT) Received: by 10.229.26.135 with HTTP; Mon, 6 Oct 2014 16:19:44 -0700 (PDT) In-Reply-To: References: Date: Mon, 6 Oct 2014 16:19:44 -0700 Message-ID: Subject: Re: [google/gcc-4_9] Add gcc driver option -no-pie From: Sriraman Tallam To: "Joseph S. Myers" Cc: GCC Patches , David Li , Cary Coutant , Paul Pluzhnikov X-IsSubscribed: yes On Mon, Oct 6, 2014 at 3:22 PM, Joseph S. Myers wrote: > If adding a new option, you need to document it in invoke.texi. Patch updated. Thanks Sri > > -- > Joseph S. Myers > joseph@codesourcery.com Add a negative for option -pie: -no-pie builds a position dependent executable. Note that -no-pie also negates a prior -shared. Index: gcc.c =================================================================== --- gcc.c (revision 212826) +++ gcc.c (working copy) @@ -672,9 +672,9 @@ proper position among the other output files. */ #ifndef LINK_PIE_SPEC #ifdef HAVE_LD_PIE -#define LINK_PIE_SPEC "%{pie:-pie} " +#define LINK_PIE_SPEC "%{pie:-pie} %{no-pie:}" #else -#define LINK_PIE_SPEC "%{pie:} " +#define LINK_PIE_SPEC "%{pie:} %{no-pie:}" #endif #endif @@ -3135,6 +3135,7 @@ display_help (void) fputs (_(" -c Compile and assemble, but do not link\n"), stdout); fputs (_(" -o Place the output into \n"), stdout); fputs (_(" -pie Create a position independent executable\n"), stdout); + fputs (_(" -no-pie Create a position dependent executable\n"), stdout); fputs (_(" -shared Create a shared library\n"), stdout); fputs (_("\ -x Specify the language of the following input files\n\ Index: testsuite/gcc.dg/option_no-pie.c =================================================================== --- testsuite/gcc.dg/option_no-pie.c (revision 0) +++ testsuite/gcc.dg/option_no-pie.c (revision 0) @@ -0,0 +1,7 @@ +/* { dg-do link { target pie } } */ +/* { dg-options "-no-pie" } */ + +int main(void) +{ + return 0; +} Index: doc/invoke.texi =================================================================== --- doc/invoke.texi (revision 212826) +++ doc/invoke.texi (working copy) @@ -462,7 +462,7 @@ Objective-C and Objective-C++ Dialects}. @item Linker Options @xref{Link Options,,Options for Linking}. @gccoptlist{@var{object-file-name} -l@var{library} @gol --nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol +-nostartfiles -nodefaultlibs -no-pie -nostdlib -pie -rdynamic @gol -s -static -static-libgcc -static-libstdc++ @gol -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol -shared -shared-libgcc -symbolic @gol @@ -10574,6 +10574,11 @@ These entries are usually resolved by entries in libc. These entry points should be supplied through some other mechanism when this option is specified. +@item -no-pie +@opindex no-pie +Produce a position dependent executable. This is the negative of option +@option{-pie} which produces a position independent executable. + @item -nostdlib @opindex nostdlib Do not use the standard system startup files or libraries when linking. Index: common.opt =================================================================== --- common.opt (revision 212826) +++ common.opt (working copy) @@ -2841,7 +2841,7 @@ x Driver Joined Separate shared -Driver RejectNegative Negative(pie) +Driver RejectNegative Negative(no-pie) Create a shared library shared-libgcc @@ -2885,6 +2885,10 @@ Driver symbolic Driver +no-pie +Driver RejectNegative Negative(pie) +Create a position dependent executable + pie Driver RejectNegative Negative(shared) Create a position independent executable