Patchwork PATCH: PR testsuite/45719: Fix gcc.target/i386/pad-3.c

login
register
mail settings
Submitter H.J. Lu
Date Sept. 18, 2010, 4:26 p.m.
Message ID <20100918162651.GA25740@intel.com>
Download mbox | patch
Permalink /patch/65131/
State New
Headers show

Comments

H.J. Lu - Sept. 18, 2010, 4:26 p.m.
Darwin enables PIC by default.  I checked in this patch to pass -fno-pic
to gcc.target/i386/pad-3.c as an obvious fix.


H.J.
--
Richard Guenther - Sept. 18, 2010, 6:11 p.m.
On Sat, Sep 18, 2010 at 6:26 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> Darwin enables PIC by default.  I checked in this patch to pass -fno-pic
> to gcc.target/i386/pad-3.c as an obvious fix.

You should use { dg-require-effective-target nonpic } instead.

Richard.

>
> H.J.
> --
> diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
> index f1193f9..c25cf28 100644
> --- a/gcc/testsuite/ChangeLog
> +++ b/gcc/testsuite/ChangeLog
> @@ -1,3 +1,8 @@
> +2010-09-18  H.J. Lu  <hongjiu.lu@intel.com>
> +
> +       PR testsuite/45719
> +       * gcc.target/i386/pad-3.c: Pass -fno-pic.
> +
>  2010-09-17  H.J. Lu  <hongjiu.lu@intel.com>
>
>        * gcc.target/i386/pad-1.c: New.
> diff --git a/gcc/testsuite/gcc.target/i386/pad-3.c b/gcc/testsuite/gcc.target/i386/pad-3.c
> index 52442b4..28db2cc 100644
> --- a/gcc/testsuite/gcc.target/i386/pad-3.c
> +++ b/gcc/testsuite/gcc.target/i386/pad-3.c
> @@ -1,5 +1,5 @@
>  /* { dg-do compile } */
> -/* { dg-options "-O2 -fomit-frame-pointer -march=atom -S" } */
> +/* { dg-options "-O2 -fomit-frame-pointer -march=atom -fno-pic -S" } */
>  /* { dg-final { scan-assembler-not "nop" } } */
>  /* { dg-final { scan-assembler-not "rep" } } */
>
>
H.J. Lu - Sept. 18, 2010, 6:17 p.m.
On Sat, Sep 18, 2010 at 11:11 AM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Sat, Sep 18, 2010 at 6:26 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:
>> Darwin enables PIC by default.  I checked in this patch to pass -fno-pic
>> to gcc.target/i386/pad-3.c as an obvious fix.
>
> You should use { dg-require-effective-target nonpic } instead.
>
>

Won't it skip the test on Darwin?

This testcase checks we only pad small functions. Since we
will always pad PIC thunk, we get false positive on Darwin.
-fno-pic removes PIC thunk so that we can run this test for
all x86 targets.
Richard Guenther - Sept. 18, 2010, 6:26 p.m.
On Sat, Sep 18, 2010 at 8:17 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Sat, Sep 18, 2010 at 11:11 AM, Richard Guenther
> <richard.guenther@gmail.com> wrote:
>> On Sat, Sep 18, 2010 at 6:26 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:
>>> Darwin enables PIC by default.  I checked in this patch to pass -fno-pic
>>> to gcc.target/i386/pad-3.c as an obvious fix.
>>
>> You should use { dg-require-effective-target nonpic } instead.
>>
>>
>
> Won't it skip the test on Darwin?

No, it should pass -fno-pic if that is possible and only skip if it is not.

> This testcase checks we only pad small functions. Since we
> will always pad PIC thunk, we get false positive on Darwin.
> -fno-pic removes PIC thunk so that we can run this test for
> all x86 targets.
>
>
> --
> H.J.
>
H.J. Lu - Sept. 18, 2010, 9:40 p.m.
On Sat, Sep 18, 2010 at 11:26 AM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Sat, Sep 18, 2010 at 8:17 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Sat, Sep 18, 2010 at 11:11 AM, Richard Guenther
>> <richard.guenther@gmail.com> wrote:
>>> On Sat, Sep 18, 2010 at 6:26 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:
>>>> Darwin enables PIC by default.  I checked in this patch to pass -fno-pic
>>>> to gcc.target/i386/pad-3.c as an obvious fix.
>>>
>>> You should use { dg-require-effective-target nonpic } instead.
>>>
>>>
>>
>> Won't it skip the test on Darwin?
>
> No, it should pass -fno-pic if that is possible and only skip if it is not.

That is not true. I got

Executing on host:
/export/build/gnu/gcc-cross/build-x86_64-apple-darwin10.4.0/gcc/xgcc
-B/export/build/gnu/gcc-cross/build-x86_64-apple-darwin10.4.0/gcc/
nonpic23923.c  -S  -m32 -o nonpic23923.s    (timeout = 300)
nonpic23923.c:3:3: error: #error FOO^M
compiler exited with status 1
output is:
nonpic23923.c:3:3: error: #error FOO^M

UNSUPPORTED: gcc.target/i386/pad-3.c

Patch

diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index f1193f9..c25cf28 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@ 
+2010-09-18  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR testsuite/45719
+	* gcc.target/i386/pad-3.c: Pass -fno-pic.
+
 2010-09-17  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* gcc.target/i386/pad-1.c: New.
diff --git a/gcc/testsuite/gcc.target/i386/pad-3.c b/gcc/testsuite/gcc.target/i386/pad-3.c
index 52442b4..28db2cc 100644
--- a/gcc/testsuite/gcc.target/i386/pad-3.c
+++ b/gcc/testsuite/gcc.target/i386/pad-3.c
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-O2 -fomit-frame-pointer -march=atom -S" } */
+/* { dg-options "-O2 -fomit-frame-pointer -march=atom -fno-pic -S" } */
 /* { dg-final { scan-assembler-not "nop" } } */
 /* { dg-final { scan-assembler-not "rep" } } */