From patchwork Sun Aug 26 21:28:49 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerald Pfeifer X-Patchwork-Id: 180088 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 BFA582C00D7 for ; Mon, 27 Aug 2012 07:29:11 +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=1346621354; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Date: From:To:Subject:In-Reply-To:Message-ID:References:MIME-Version: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=C/ILd5/ vMeznKisYiX9wtv19IDg=; b=lFbP6YhcS29LegHl6jA3rHzbCIDiJTOPCpnUqBF 6MPfQufISk3KlTJ0QTyEY04gqCIA94ADqTGgIsGfJZR5Q3g2jKP4mxkEzdXnLYYW ukh36/qanxBX1YFqmhPFny/uwJGZZQUEi5gqCdQtqhlr0IB1EOqWisr6dJgORHQa NmHg= 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:Date:From:To:Subject:In-Reply-To:Message-ID:References:MIME-Version:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=PppIv4XQl1oAgi0eZ1o5xwrXoOhism5ZMrSPLIfJRekIjfG/drno+J50NLzC1V SG+32HrUIFVIptnljlSPIdizcFAxf9338nSLiHfN74O2eUpAZpb9V+vkpxu6SdBU HYMjSgJJh93unbDTcYZbcZjI84J2/af+2s6C00HpZDFn0=; Received: (qmail 18326 invoked by alias); 26 Aug 2012 21:29:05 -0000 Received: (qmail 18317 invoked by uid 22791); 26 Aug 2012 21:29:05 -0000 X-SWARE-Spam-Status: No, hits=-51.7 required=5.0 tests=AWL, BAYES_00, KHOP_THREADED X-Spam-Check-By: sourceware.org Received: from ainaz.pair.com (HELO ainaz.pair.com) (209.68.2.66) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 26 Aug 2012 21:28:51 +0000 Received: from [192.168.0.129] (vie-188-118-248-247.dsl.sil.at [188.118.248.247]) by ainaz.pair.com (Postfix) with ESMTPSA id EF5DD3F40F; Sun, 26 Aug 2012 17:28:49 -0400 (EDT) Date: Sun, 26 Aug 2012 23:28:49 +0200 (CEST) From: Gerald Pfeifer To: Alexis Ballier , gcc-patches@gcc.gnu.org, Loren James Rittle Subject: [PATCH,PING]] gcc/config/freebsd-spec.h: Fix building PIE In-Reply-To: <20120508101037.283af058@gentoo.org> Message-ID: References: <1336485223-20028-1-git-send-email-aballier@gentoo.org> <20120508101037.283af058@gentoo.org> 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 I have tested this patch on i386-unknown-freebsd10.0 and volunteer to create a ChangeLog and apply if approved. Any reviewer? On Tue, 8 May 2012, Alexis Ballier wrote: > For the record, there's a similar logic in FreeBSD's gcc: > http://svnweb.freebsd.org/base/head/contrib/gcc/config/freebsd-spec.h?revision=200038&view=markup Thanks for the patch, Alexis. One question: why do we have the same in freebsd-spec.h and i386/freebsd.h. Isn't there a way to simplify this? Like omitting this from i386/freebsd.h at all? Gerald --- gcc/config/freebsd-spec.h | 9 +++------ gcc/config/i386/freebsd.h | 9 +++------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/gcc/config/freebsd-spec.h b/gcc/config/freebsd-spec.h index 770a3d1..2808582 100644 --- a/gcc/config/freebsd-spec.h +++ b/gcc/config/freebsd-spec.h @@ -64,11 +64,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see before entering `main'. */ #define FBSD_STARTFILE_SPEC \ - "%{!shared: \ - %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \ - %{!p:%{profile:gcrt1.o%s} \ - %{!profile:crt1.o%s}}}} \ - crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}" + "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \ + crti.o%s %{shared|pie:crtbeginS.o%s;:crtbegin.o%s}" /* Provide a ENDFILE_SPEC appropriate for FreeBSD. Here we tack on the magical crtend.o file (see crtstuff.c) which provides part of @@ -77,7 +74,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see `crtn.o'. */ #define FBSD_ENDFILE_SPEC \ - "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s" + "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s" /* Provide a LIB_SPEC appropriate for FreeBSD as configured and as required by the user-land thread model. Before __FreeBSD_version diff --git a/gcc/config/i386/freebsd.h b/gcc/config/i386/freebsd.h index 649274d..dd69e43 100644 --- a/gcc/config/i386/freebsd.h +++ b/gcc/config/i386/freebsd.h @@ -67,11 +67,8 @@ along with GCC; see the file COPYING3. If not see #undef STARTFILE_SPEC #define STARTFILE_SPEC \ - "%{!shared: \ - %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \ - %{!p:%{profile:gcrt1.o%s} \ - %{!profile:crt1.o%s}}}} \ - crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}" + "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \ + crti.o%s %{shared|pie:crtbeginS.o%s;:crtbegin.o%s}" /* Provide a ENDFILE_SPEC appropriate for FreeBSD. Here we tack on the magical crtend.o file (see crtstuff.c) which provides part of @@ -81,7 +78,7 @@ along with GCC; see the file COPYING3. If not see #undef ENDFILE_SPEC #define ENDFILE_SPEC \ - "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s" + "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s" /* Provide a LINK_SPEC appropriate for FreeBSD. Here we provide support for the special GCC options -static and -shared, which allow us to