From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22646 invoked by alias); 7 Jun 2011 16:48:32 -0000 Received: (qmail 22622 invoked by uid 22791); 7 Jun 2011 16:48:28 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from snape.CeBiTec.Uni-Bielefeld.DE (HELO smtp-relay.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 07 Jun 2011 16:48:13 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id F37B0667; Tue, 7 Jun 2011 18:48:11 +0200 (CEST) Received: from smtp-relay.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (malfoy.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) (amavisd-new, port 10024) with LMTP id GNiFY5O1ycEW; Tue, 7 Jun 2011 18:48:09 +0200 (CEST) Received: from manam.CeBiTec.Uni-Bielefeld.DE (manam.CeBiTec.Uni-Bielefeld.DE [129.70.161.120]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPS id D6507666; Tue, 7 Jun 2011 18:48:08 +0200 (CEST) Received: (from ro@localhost) by manam.CeBiTec.Uni-Bielefeld.DE (8.14.4+Sun/8.14.4/Submit) id p57Gm8p0004345; Tue, 7 Jun 2011 18:48:08 +0200 (MEST) From: Rainer Orth To: Jakub Jelinek Cc: gcc-patches@gcc.gnu.org Subject: Re: [testsuite] Run TLS torture tests with -fpic etc. References: <20110603194403.GG17079@tyan-ft48-01.lab.bos.redhat.com> Date: Tue, 07 Jun 2011 16:48:00 -0000 In-Reply-To: (Rainer Orth's message of "Mon, 06 Jun 2011 11:42:32 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (usg-unix-v) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-IsSubscribed: yes 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 X-SW-Source: 2011-06/txt/msg00546.txt.bz2 Jakub, any word on this patch? I think I only need approval for the gcc.c part. Thanks. Rainer Rainer Orth writes: > Jakub Jelinek writes: > >> On Fri, Jun 03, 2011 at 09:38:31PM +0200, Rainer Orth wrote: >>> Rainer Orth writes: >>> Jakub, any suggestion how to properly test for -fpie/-fPIE support? >>> Otherwise, I'll remove that part of the patch for now and just commit >>> the -fpic/-fPIC one. >> >> You want to compile/link the program with -pie -fpie rather than just -fpie, >> if it links, otherwise you are testing just linking PIC code into normal >> executables. > > Ok, thanks. Unfortunately, this didn't work out of the box since for > targets where the linker doesn't support -pie, gcc silently ignores it > which I think is bad style. > > The following patch corrects this by rejecting -pie in this case. I've > also added a effective-target keyword pie for testsuite use, both below > and in the revised TLS torture tests to be submitted separately. > > I didn't introduce a separte fpie keyword since e.g. gcc.dg/tls/pie-1.c > uses fpic for that purpose, but maybe I should? > > One other question: gcc.target/i386/pr39013-[12].c is currently > restricted to *-*-linux*. Any particular reason for that? > > Bootstrapped without regressions on i386-pc-solaris2.11 with Sun ld (no > -pie support, pie-link becomes UNSUPPORTED) and with GNU ld 2.21 (-pie > support, 32-bit pie-link works, 64-bit pie-link becomes unsupported: > > /vol/gcc/bin/gld-2.21: /usr/lib/amd64/crt1.o: relocation R_X86_64_32S against `_DYNAMIC' can not be used when making a shared object; recompile with -fPIC > /usr/lib/amd64/crt1.o: could not read symbols: Bad value > > ). Ok for mainline? > > Thanks. > Rainer > > > 2011-06-04 Rainer Orth > > gcc: > * gcc.c [!HAVE_LD_PIE] (LINK_PIE_SPEC): Reject -pie. > * doc/sourcebuild.texi (Effective-Target Keywords, pie): Document it. > > gcc/testsuite: > * lib/target-supports.exp (check_effective_target_pie): New proc. > * gcc.dg/pie-link.c: Use target pie. > Add -pie to dg-options. > > diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi > --- a/gcc/doc/sourcebuild.texi > +++ b/gcc/doc/sourcebuild.texi > @@ -1782,6 +1782,9 @@ Target defines @code{PCC_BITFIELD_TYPE_M > @item pe_aligned_commons > Target supports @option{-mpe-aligned-commons}. > > +@item pie > +Target supports @option{-pie}, @option{-fpie} and @option{-fPIE}. > + > @item section_anchors > Target supports section anchors. > > diff --git a/gcc/gcc.c b/gcc/gcc.c > --- a/gcc/gcc.c > +++ b/gcc/gcc.c > @@ -612,7 +612,7 @@ proper position among the other output f > #ifdef HAVE_LD_PIE > #define LINK_PIE_SPEC "%{pie:-pie} " > #else > -#define LINK_PIE_SPEC "%{pie:} " > +#define LINK_PIE_SPEC "%{pie:%e-pie is not supported in this configuration} " > #endif > #endif > > diff --git a/gcc/testsuite/gcc.dg/pie-link.c b/gcc/testsuite/gcc.dg/pie-link.c > --- a/gcc/testsuite/gcc.dg/pie-link.c > +++ b/gcc/testsuite/gcc.dg/pie-link.c > @@ -1,5 +1,5 @@ > -/* { dg-do link { target *-*-darwin[912]* *-*-linux* } } */ > -/* { dg-options "-fpie" } */ > +/* { dg-do link { target pie } } */ > +/* { dg-options "-pie -fpie" } */ > > int main(void) > { > diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp > --- a/gcc/testsuite/lib/target-supports.exp > +++ b/gcc/testsuite/lib/target-supports.exp > @@ -788,6 +788,18 @@ proc check_effective_target_fpic { } { > return 0 > } > > +# Return 1 if -pie, -fpie and -fPIE are supported, as in no warnings or errors > +# emitted, 0 otherwise. > + > +proc check_effective_target_pie { } { > + if [check_no_compiler_messages pie executable { > + int main (void) { return 0; } > + } "-pie -fpie"] { > + return 1 > + } > + return 0 > +} > + > # Return true if the target supports -mpaired-single (as used on MIPS). > > proc check_effective_target_mpaired_single { } { -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University