From patchwork Mon Sep 10 23:14:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Granberg X-Patchwork-Id: 182971 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 10F702C0080 for ; Tue, 11 Sep 2012 09:36:29 +1000 (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=1347924990; h=Comment: DomainKey-Signature:Received:Received:Received:Received:From:To: Subject:Date:Message-ID:User-Agent:In-Reply-To:References: MIME-Version:Content-Type:Content-Transfer-Encoding:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=Zg/NzT2IcbwIQIN5UVZCf6ZGSBs=; b=L/tGm6gdAOGEOZq//6HAlDl2BLedlQSKlIm1OGAbgXiHPxcsA6T3FaJFro+BM7 xvijbKs7fuwWcMU+jkG72qdZyzY+LGjk1Q2+iOtPSFxLb3f7l4KcTeUfbmXYewNJ nbA0v4o2LZWhWI7Uhbg+CC+HRg48sWHDbVVKkEUHCZKhY= 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:From:To:Subject:Date:Message-ID:User-Agent:In-Reply-To:References:MIME-Version:Content-Type:Content-Transfer-Encoding:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=Emz5I4OmI8CAyx8mJ30m2v3MHpt/Z7vX20Mz+jgneD2B8aUneuJDz9y/TCQgN8 hFuVzBor80edHIxJv49q4aPkVNX4zQ2h0vaS46mJw/+pFOQEBJFLNHGnlwAojyM4 30UqEH4PqXYpyVqb2N1abULfyxMTsGXZEbmogNXun8T3A=; Received: (qmail 15500 invoked by alias); 10 Sep 2012 23:36:23 -0000 Received: (qmail 15406 invoked by uid 22791); 10 Sep 2012 23:36:21 -0000 X-SWARE-Spam-Status: No, hits=-6.0 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, KHOP_THREADED, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp.gentoo.org (HELO smtp.gentoo.org) (140.211.166.183) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 10 Sep 2012 23:36:00 +0000 Received: from laptop1.gw.ume.nu (ip1-67.bon.riksnet.se [77.110.8.67]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: zorry) by smtp.gentoo.org (Postfix) with ESMTPSA id 9C91D33C1F0 for ; Mon, 10 Sep 2012 23:35:59 +0000 (UTC) From: Magnus Granberg To: gcc-patches@gcc.gnu.org Subject: Re: [PATCH 3-4/12 ] New configure option --enable-espf=(all|ssp|pie|no) Date: Tue, 11 Sep 2012 01:14:26 +0200 Message-ID: <1756483.vfyG7SOdE3@laptop1.gw.ume.nu> User-Agent: KMail/4.8.3 (Linux/3.3.0-hardened; KDE/4.8.3; x86_64; ; ) In-Reply-To: References: <3780683.ka1IE7f3ja@laptop1.gw.ume.nu> MIME-Version: 1.0 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 fredag 07 september 2012 18.43.59 skrev du: > On Fri, 7 Sep 2012, Magnus Granberg wrote: > > --- a/gcc/config/linux.h 2011-07-07 17:38:34.000000000 +0200 > > +++ b/gcc/config/linux.h 2012-07-09 14:24:08.599281404 +0200 > > I see nothing related specifically to Linux rather than other targets that > may use GNU userspace, so I think all this belongs in gnu-user.h. > > > --- a/gcc/config/i386/linux.h 2011-06-03 20:30:39.000000000 +0200 > > Likewise. > > > +#if def ENABLE_ESPF > > Stray space inside #ifdef. Have updated the patch and move from linux*.h to gnu-user*.h. Thank you for the hints. Gentoo Hardened Project Magnus Granberg --- a/gcc/config/gnu-user.h 2011-04-28 18:49:49.000000000 +0200 +++ b/gcc/config/gnu-user.h 2012-09-08 18:22:41.020729353 +0200 @@ -98,3 +98,31 @@ see the files COPYING3 and COPYING.RUNTI #define TARGET_C99_FUNCTIONS 1 #define TARGET_HAS_SINCOS 1 + +#ifdef ENABLE_ESPF +#ifdef ENABLE_ESPF_PIE +#define ESPF_GCC_PIE_SPEC \ +"%{pie|fpic|fPIC|fpie|fPIE|fno-pic|fno-PIC|fno-pie|fno-PIE| \ +shared|static|nostdlib|nostartfiles:;:-fPIE -pie}" +#else +#define ESPF_GCC_PIE_SPEC "" +#endif +#ifdef ENABLE_ESPF_SSP +#define ESPF_GCC_SSP_SPEC \ +"%{nostdlib|nodefaultlibs|fno-stack-protector| \ +fstack-protector|fstack-protector-all:;:-fstack-protector}" +#else +#define ESPF_GCC_SSP_SPEC "" +#endif +#ifdef ENABLE_ESPF_FORTIFY +#define ESPF_CPP_UNIQUE_OPTIONS_SPEC \ +"%{D_FORTIFY_SOURCE|D_FORTIFY_SOURCE=*|U_FORTIFY_SOURCE:;:-D_FORTIFY_SOURCE=2}" +#else +#define ESPF_CPP_UNIQUE_OPTIONS_SPEC "" +#endif +#define ESPF_DRIVER_SELF_SPECS \ +ESPF_GCC_PIE_SPEC, \ +ESPF_GCC_SSP_SPEC +#define ESPF_EXTRA_SPECS \ +{ "espf_cpp_unique_options", ESPF_CPP_UNIQUE_OPTIONS_SPEC } +#endif --- a/gcc/config/i386/gnu-user.h 2011-05-05 14:32:50.000000000 +0200 +++ b/gcc/config/i386/gnu-user.h 2012-07-09 14:28:38.726289455 +0200 @@ -93,9 +93,16 @@ along with GCC; see the file COPYING3. "--32 %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}" #undef SUBTARGET_EXTRA_SPECS +#ifdef ENABLE_ESPF #define SUBTARGET_EXTRA_SPECS \ { "link_emulation", GNU_USER_LINK_EMULATION },\ - { "dynamic_linker", GNU_USER_DYNAMIC_LINKER } + { "dynamic_linker", GNU_USER_DYNAMIC_LINKER }, \ + ESPF_EXTRA_SPECS +#else +#define SUBTARGET_EXTRA_SPECS \ + { "link_emulation", GNU_USER_LINK_EMULATION },\ + { "dynamic_linker", GNU_USER_DYNAMIC_LINKER } +#endif #undef LINK_SPEC #define LINK_SPEC "-m %(link_emulation) %{shared:-shared} \ @@ -202,3 +159,7 @@ along with GCC; see the file COPYING3. #define TARGET_CAN_SPLIT_STACK #define TARGET_THREAD_SPLIT_STACK_OFFSET 0x30 #endif + +#ifdef ENABLE_ESPF +#define DRIVER_SELF_SPECS ESPF_DRIVER_SELF_SPECS +#endif --- gcc-4.8-20120302/gcc/config/i386/gnu-user64.h 2012-06-30 00:21:30.000000000 +0200 +++ gcc-4.8-20120302-work/gcc/config/i386/gnu-user64.h 2012-09-08 18:14:03.683713936 +0200 @@ -94,3 +94,7 @@ see the files COPYING3 and COPYING.RUNTI #undef WCHAR_TYPE #define WCHAR_TYPE (TARGET_LP64 ? "int" : "long int") + +#ifdef ENABLE_ESPF +#define DRIVER_SELF_SPECS ESPF_DRIVER_SELF_SPECS +#endif --- a/gcc/config/i386/i386.h 2011-11-24 23:11:12.000000000 +0100 +++ b/gcc/config/i386/i386.h 2012-07-09 14:21:24.575276517 +0200 @@ -617,13 +617,16 @@ enum target_cpu_default Do not define this macro if it does not need to do anything. */ #ifndef SUBTARGET_EXTRA_SPECS +#ifdef ENABLE_ESPF +#define SUBTARGET_EXTRA_SPECS ESPF_EXTRA_SPECS +#else #define SUBTARGET_EXTRA_SPECS #endif +#endif #define EXTRA_SPECS \ { "cc1_cpu", CC1_CPU_SPEC }, \ SUBTARGET_EXTRA_SPECS - /* Set the value of FLT_EVAL_METHOD in float.h. When using only the FPU, assume that the fpcw is set to extended precision; when using