From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5093 invoked by alias); 10 Jan 2015 01:56:11 -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 5081 invoked by uid 89); 10 Jan 2015 01:56:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 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-f50.google.com Received: from mail-oi0-f50.google.com (HELO mail-oi0-f50.google.com) (209.85.218.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sat, 10 Jan 2015 01:56:08 +0000 Received: by mail-oi0-f50.google.com with SMTP id x69so14382770oia.9 for ; Fri, 09 Jan 2015 17:56:06 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.202.177.137 with SMTP id a131mr357917oif.67.1420854966761; Fri, 09 Jan 2015 17:56:06 -0800 (PST) Received: by 10.76.185.7 with HTTP; Fri, 9 Jan 2015 17:56:06 -0800 (PST) In-Reply-To: <1684904.ZuMb4HIbCc@laptop1.gw.ume.nu> References: <4827012.p4mTkPPu1h@laptop1.gw.ume.nu> <54B0172E.50600@gmail.com> <1684904.ZuMb4HIbCc@laptop1.gw.ume.nu> Date: Sat, 10 Jan 2015 02:32: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: "H.J. Lu" To: Magnus Granberg Cc: GCC Patches Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-01/txt/msg00573.txt.bz2 On Fri, Jan 9, 2015 at 12:12 PM, Magnus Granberg wrote: > fredag 09 januari 2015 13.00.14 skrev Daniel Micay: >> On 09/01/15 12:49 PM, Joseph Myers wrote: >> > On Fri, 9 Jan 2015, Daniel Micay wrote: >> >>> --with-specs="%{pie|fpic|fPIC|fpie|fPIE|fno-pic|fno-PIC|fno-pie|fno-PIE| >> >>> shared|static|nostdlib|nodefaultlibs|nostartfiles:;:-fPIE -pie}" >> >>> >> >>> at configure time (using CONFIGURE_SPECS). > DRIVER_SELF_SPECS is checkt before CONFIGURE_SPECS. On mips it will have added > -mno-shared before it check CONFIGURE_SPECS. I want to support more targets > later on. Can move the spec to elfos.h. >> >>> >> >>> 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 >> >> >> >> PIE isn't supported for static executables by binutils, etc. so it >> >> does need to exclude that. The checks for nostdlib, nodefaultlibs >> > >> > Well - that would indicate excluding -pie if one of the link-time options >> > conflicting with it is used, -fPIE if one of the compile-time options >> > conflicting with it is used. That way, "gcc -static file.c" would still >> > have the same effect as "gcc -c file.c; gcc -static file.o" (building a >> > PIE object, linking it into a non-PIE static executable), which makes >> > logical sense to me (although there may be no great benefit either way). >> >> Sure, I agree. It should have separate lists of exceptions for both of >> these. > I can separete it to compile and linke sections and remove the nostdlib, > nodefaultlibs and nostartfiles. But how do we not pass -pie to the linker when > we don't pass static or shared and don't link it with -pie? For only the gold > linker support -no-pie. > > /Magnus G. > > Please try hjl/pie branch: https://gcc.gnu.org/git/?p=gcc.git;a=summary and let know if it works for you. -- H.J.