diff mbox

[testsuite] Link gcc.dg/pie-link.c with -pie

Message ID yddmvwtb9xo.fsf@lokon.CeBiTec.Uni-Bielefeld.DE
State New
Headers show

Commit Message

Rainer Orth Sept. 11, 2015, 9:08 a.m. UTC
While starting to develop the patch for Solaris PIE support,
the gcc.dg/pie-link.c test succeeded at a point when it shouldn't have,
i.e. before I had PIC crt files.  In its current form, the test doesn't
test what it's supposed to test, namely successfully linking position
independent executables, because it compiles with -fpie, but links as a
regular executable.  The test was added here

2007-06-01  Geoffrey Keating  <geoffk@apple.com>

	* gcc.dg/pie-link.c: New test.

https://gcc.gnu.org/ml/gcc-patches/2007-06/msg00070.html

-pie doesn't make a difference on Darwin, but very much so on Linux and
Solaris, where it is necessary for PIE creation.

Fixed thus, tested on x86_64-unknown-linux-gnu and *-*-solaris2.12 with
my upcoming PIE patch.

Ok for mainline and gcc-5 branch?

	Rainer


2015-02-10  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* gcc.dg/pie-link.c: Add -pie to dg-options.

Comments

Jakub Jelinek Sept. 11, 2015, 9:18 a.m. UTC | #1
On Fri, Sep 11, 2015 at 11:08:03AM +0200, Rainer Orth wrote:
> While starting to develop the patch for Solaris PIE support,
> the gcc.dg/pie-link.c test succeeded at a point when it shouldn't have,
> i.e. before I had PIC crt files.  In its current form, the test doesn't
> test what it's supposed to test, namely successfully linking position
> independent executables, because it compiles with -fpie, but links as a
> regular executable.  The test was added here
> 
> 2007-06-01  Geoffrey Keating  <geoffk@apple.com>
> 
> 	* gcc.dg/pie-link.c: New test.
> 
> https://gcc.gnu.org/ml/gcc-patches/2007-06/msg00070.html
> 
> -pie doesn't make a difference on Darwin, but very much so on Linux and
> Solaris, where it is necessary for PIE creation.
> 
> Fixed thus, tested on x86_64-unknown-linux-gnu and *-*-solaris2.12 with
> my upcoming PIE patch.
> 
> Ok for mainline and gcc-5 branch?
> 
> 	Rainer
> 
> 
> 2015-02-10  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
> 
> 	* gcc.dg/pie-link.c: Add -pie to dg-options.

Ok (if it doesn't work on Darwin, it can be conditionalized on !darwin).

> --- a/gcc/testsuite/gcc.dg/pie-link.c
> +++ b/gcc/testsuite/gcc.dg/pie-link.c
> @@ -1,5 +1,5 @@
>  /* { dg-do link { target pie } } */
> -/* { dg-options "-fpie" } */
> +/* { dg-options "-fpie -pie" } */
>  
>  int main(void)
>  {

	Jakub
Rainer Orth Sept. 11, 2015, 9:28 a.m. UTC | #2
Jakub Jelinek <jakub@redhat.com> writes:

> On Fri, Sep 11, 2015 at 11:08:03AM +0200, Rainer Orth wrote:
>> While starting to develop the patch for Solaris PIE support,
>> the gcc.dg/pie-link.c test succeeded at a point when it shouldn't have,
>> i.e. before I had PIC crt files.  In its current form, the test doesn't
>> test what it's supposed to test, namely successfully linking position
>> independent executables, because it compiles with -fpie, but links as a
>> regular executable.  The test was added here
>> 
>> 2007-06-01  Geoffrey Keating  <geoffk@apple.com>
>> 
>> 	* gcc.dg/pie-link.c: New test.
>> 
>> https://gcc.gnu.org/ml/gcc-patches/2007-06/msg00070.html
>> 
>> -pie doesn't make a difference on Darwin, but very much so on Linux and
>> Solaris, where it is necessary for PIE creation.
>> 
>> Fixed thus, tested on x86_64-unknown-linux-gnu and *-*-solaris2.12 with
>> my upcoming PIE patch.
>> 
>> Ok for mainline and gcc-5 branch?
>> 
>> 	Rainer
>> 
>> 
>> 2015-02-10  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
>> 
>> 	* gcc.dg/pie-link.c: Add -pie to dg-options.
>
> Ok (if it doesn't work on Darwin, it can be conditionalized on !darwin).

I had it in my Darwin builds and it passed, -pie being a no-op on that
target.

Thanks.
        Rainer
diff mbox

Patch

# HG changeset patch
# Parent 3e8c1a7c7f81ba581f0dd21ef2fc84ba136ec40d
Link gcc.dg/pie-link.c with -pie

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 pie } } */
-/* { dg-options "-fpie" } */
+/* { dg-options "-fpie -pie" } */
 
 int main(void)
 {