From patchwork Tue Nov 13 20:45:54 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 198785 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]) by ozlabs.org (Postfix) with SMTP id EEC662C0087 for ; Wed, 14 Nov 2012 07:46:09 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1353444371; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:To:Subject:Date:Message-ID:User-Agent:MIME-Version: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=YaeEZu+ wQKz5EJrHdEuuEp2s5YQ=; b=H8px1lqRGg5vziGR8Qr2u0VxzMSkcxBtilj7U8F V2xyZGcg1fUPgU8GAM7IQGFoljAQxHZ+SUEQ4FKuNvz4xsn3UPNVKE5iRgyePpRS vrTvPtCBQRmQad7bowpdiTStMDkAW3frA+pYACEg3G0K6uDxqVg08oBc8Ay7a1Vf zAU8= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:X-Google-DKIM-Signature:Received:Received:From:To:Subject:Date:Message-ID:User-Agent:MIME-Version:Content-Type:X-Gm-Message-State:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=KFM/EVqMGlQ2GeHIGo6b2VkLP/5gdfLdFV4IEK5CBGKkZERVG6V7FfgZ89rlda 5w8Z2M1GgddEbWo7zGsM1kJopbxu44XfzWnfEy2Pv4e0Otq5IeLoZhfi05gUvT+m Y23B/WRBL2bAN1bBAmMOkUz/G8RugfFgQSk1v/f5OlP1M=; Received: (qmail 3875 invoked by alias); 13 Nov 2012 20:46:05 -0000 Received: (qmail 3854 invoked by uid 22791); 13 Nov 2012 20:46:02 -0000 X-SWARE-Spam-Status: No, hits=-4.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from mail-pa0-f47.google.com (HELO mail-pa0-f47.google.com) (209.85.220.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 13 Nov 2012 20:45:56 +0000 Received: by mail-pa0-f47.google.com with SMTP id fa11so5024375pad.20 for ; Tue, 13 Nov 2012 12:45:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:subject:date:message-id:user-agent:mime-version :content-type:x-gm-message-state; bh=QLnIsmK5PTRnHatWdXkrBavhl9PIzS0NNTQjQKjl7q8=; b=MPdMyPIRW566h1lzWBi9jNUj2gutDLdS9/9pInU7AR/Z8R7bnlXMEJMnLkK9toMs/K 4QadrOQ0yDKrIdnKGAHmE2jaJuU4Vt/3opNX5WjxXpBYVnT0uYQEmWnuCdCyw+5f1wcz m+SaRyNdyNsXDJjNunwuMyNQJiiG4YvJRYaVfQK4t7tiUx7ifkDjjvEhC5DFjTL863SX Um3sSgI7N5SiN7UPY7UGipjLXW3usZzTrH9vdjb/aW7nEYjD3CO0gDsKcSijy7Mv/OaS V8lRKkBgaxluQrA+NxWs7MQfHimDq7px92Tb6WnC21KE6vPlH/B7dJENQxdksQKj5t+s lgrw== Received: by 10.66.78.136 with SMTP id b8mr875130pax.26.1352839556331; Tue, 13 Nov 2012 12:45:56 -0800 (PST) Received: from coign.google.com ([2620:0:1000:1804:224:d7ff:fe8f:f634]) by mx.google.com with ESMTPS id pv8sm6468671pbc.26.2012.11.13.12.45.55 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 13 Nov 2012 12:45:55 -0800 (PST) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org Subject: Patch RFA: Fix -fpie -fpic Date: Tue, 13 Nov 2012 12:45:54 -0800 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 X-Gm-Message-State: ALoCoQlAACHhDLbxLRhPVZgFDhszJnM+2zmGzAH2ERbi+EzTS/ICBuQQDmPmuitb5/TT+kMsglURwLW4iT5NRo0//lr95WIktKOn0cNbcWpg2DuhLkStu8bghUZ/ljsqu46QSwrm53kK8EWsqPK7t4s6VmkO92QzWROq5xVT554wXjuDQwm0qw9EwJxgd3ApBLAUawksspyY X-IsSubscribed: yes 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 Right now if you run "gcc -fpie -fpic" you get, in effect, "gcc -fpie". I think you should get "gcc -fpic". In general I think that of the options -fpic, -fPIC, -fpie, -fPIE, -fno-pic, -fno-PIC, -fno-pie, -fno-PIE the compiler should act as though only the last of those options were specified. That follows the usual formulat in which the last option wins. This patch implements that. Bootstrapped and tested on x86_64-unknown-linux-gnu. OK for mainline? Ian 2012-11-13 Ian Lance Taylor * common.opt (fPIC, fPIE, fpic, fpie): Create a Negative loop such that any of these options disables the others. Index: common.opt =================================================================== --- common.opt (revision 193484) +++ common.opt (working copy) @@ -1583,19 +1583,19 @@ Common Report Var(flag_peephole2) Optimi Enable an RTL peephole pass before sched2 fPIC -Common Report Var(flag_pic,2) +Common Report Var(flag_pic,2) Negative(fPIE) Generate position-independent code if possible (large mode) fPIE -Common Report Var(flag_pie,2) +Common Report Var(flag_pie,2) Negative(fpic) Generate position-independent code for executables if possible (large mode) fpic -Common Report Var(flag_pic,1) +Common Report Var(flag_pic,1) Negative(fpie) Generate position-independent code if possible (small mode) fpie -Common Report Var(flag_pie,1) +Common Report Var(flag_pie,1) Negative(fPIC) Generate position-independent code for executables if possible (small mode) fplugin=