From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32487 invoked by alias); 9 Jan 2015 12:58:50 -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 32478 invoked by uid 89); 9 Jan 2015 12:58:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-oi0-f47.google.com Received: from mail-oi0-f47.google.com (HELO mail-oi0-f47.google.com) (209.85.218.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 09 Jan 2015 12:58:48 +0000 Received: by mail-oi0-f47.google.com with SMTP id v63so11759947oia.6 for ; Fri, 09 Jan 2015 04:58:45 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.60.45.167 with SMTP id o7mr9339298oem.70.1420808325851; Fri, 09 Jan 2015 04:58:45 -0800 (PST) Received: by 10.76.177.230 with HTTP; Fri, 9 Jan 2015 04:58:45 -0800 (PST) In-Reply-To: <1625902.vd5h90ZESU@laptop1.gw.ume.nu> References: <4827012.p4mTkPPu1h@laptop1.gw.ume.nu> <2546517.6r217PbQ20@laptop1.gw.ume.nu> <3640063.8rDKLvUbS6@laptop1.gw.ume.nu> <1625902.vd5h90ZESU@laptop1.gw.ume.nu> Date: Fri, 09 Jan 2015 13:04:00 -0000 Message-ID: Subject: Re: [PING][PATCH][1-3] New configure options that make the compiler use -fPIE and -pie as default option From: Richard Biener To: Magnus Granberg , "Joseph S. Myers" Cc: GCC Patches , danielmicay@gmail.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2015-01/txt/msg00506.txt.bz2 On Tue, Dec 30, 2014 at 10:23 PM, Magnus Granberg wrote: > fredag 14 november 2014 23.31.48 skrev Magnus Granberg: >> m=C3=A5ndag 10 november 2014 21.26.39 skrev Magnus Granberg: >> > > Rainer >> > >> > Thanks Rainer for the nits and comments. >> > Have updated the patches and Changelogs. >> > But i still use PIE_DRIVER_SELF_SPECS, do you have a ide where move it= so >> > i don't need to duplicate that stuff or how to do it? >> > >> > Magnus G >> > >> > 2014-11-10 Magnus Granberg >> > >> > /gcc >> > * config/gnu-user.h (PIE_DRIVER_SELF_SPECS) and >> > (GNU_DRIVER_SELF_SPECS): Define. >> > * config/i386/gnu-user-common.h (DRIVER_SELF_SPECS): Define >> > * configure.ac: Add new option. >> > * configure, config.in: Rebuild. >> > * Makefile.in (ALL_CFLAGS) and (ALL_CXXFLAGS): Disable PIE. >> > * doc/install.texi: New configure option. >> > * doc/invoke.texi: Add note to PIE. >> > * doc/sourcebuild.texi: New effective target. >> > gcc/testsuite >> > * gcc/default-pie.c: New test >> > * gcc.dg/tree-ssa/ssa-store-ccp-3.c: Skip if default_pie >> > * g++.dg/other/anon5.C: Skip if default_pie >> > * lib/target-supports.exp (check_effective_target_default_pie): >> > New proc. >> > /libgcc >> > * Makefile.in (CRTSTUFF_CFLAGS): Disable PIE. >> >> Can this be included for GCC 5 ? >> >> /Magnus G. > One more ping on this. The patches where sent before stage 1 closed but i > did't get any feed back from it > Have updete the patchses for gcc 5.0 20141228 snapshot. > Bootstrapped and tested on x86_64-unknown-linux-gnu (Gentoo) > /Magnus Looking at the actual implementation I wonder why it's not similar to how darwin gets at it default (not sure how it does). Also looking at how DRIVER_SELF_SPECS is used I wonder if the functionality can be enabled with a simple --with-specs=3D"%{pie|fpic|fPIC|fpie|fPIE|fno-pic|fno-PIC|fno-pie|fno-PIE|s= hared|static|nostdlib|nodefaultlibs|nostartfiles:;:-fPIE -pie}" at configure time (using CONFIGURE_SPECS). I have no idea if the above is really the proper spec to use - why do you include static, nostdlib, nodefaultlibs and nostartfiles for example? Similar, if I say gcc -pie -c t.c we will end up with a non-PIE object, and linking with -fPIE will end up with a DYN_EXEC object. I believe you want to treat link and compile arguments separately (and adjust the link spec for linking). I also would have said that elfos.h is more appropriate than gnu-user.h, but ... That said, the patch looks more like a hack (and see above how to achieve the same without a patch(?)), not like a proper implementation of a PIE default. Joseph may have an idea where the proper place for a spec-wise default PIE is. Thanks, Richard. > 2014-12-30 Magnus Granberg > > /gcc > * config/gnu-user.h (PIE_DRIVER_SELF_SPECS): Define. > * config/i386/gnu-user-common.h (DRIVER_SELF_SPECS): Define and > add PIE_DRIVER_SELF_SPECS. > * configure.ac: Add new option. > * configure, config.in: Rebuild. > * Makefile.in (ALL_CFLAGS) and (ALL_CXXFLAGS): Disable PIE. > * doc/install.texi: New configure option. > * doc/invoke.texi: Add note to PIE. > * doc/sourcebuild.texi: New effective target. > gcc/testsuite > * gcc/default-pie.c: New test > * gcc.dg/tree-ssa/ssa-store-ccp-3.c: Skip if default_pie > * g++.dg/other/anon5.C: Skip if default_pie > * lib/target-supports.exp (check_effective_target_default_pie): > New proc. > /libgcc > * Makefile.in (CRTSTUFF_CFLAGS): Disable PIE. >