From: Kaveh R. Ghazi Date: Sat, 6 Mar 2010 03:57:55 +0000 (+0000) Subject: backport: target-supports.exp (add_options_for_bind_pic_locally): New. X-Git-Tag: releases/gcc-4.3.5~152 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=391794329f1f43b9a14337b9a8f07821bd4199ef;p=thirdparty%2Fgcc.git backport: target-supports.exp (add_options_for_bind_pic_locally): New. Backport: 2009-10-15 Kaveh R. Ghazi * lib/target-supports.exp (add_options_for_bind_pic_locally): New. 2009-10-16 Kaveh R. Ghazi * g++.dg/other/first-global.C: Use dg-add-options bind_pic_locally. * g++.dg/parse/attr-externally-visible-1.C: Likewise. * g++.dg/tree-ssa/nothrow-1.C: Likewise. * gcc.dg/ipa/ipa-1.c: Likewise. * gcc.dg/ipa/ipa-2.c: Likewise. * gcc.dg/ipa/ipa-3.c: Likewise. * gcc.dg/ipa/ipa-4.c: Likewise. * gcc.dg/ipa/ipa-5.c: Likewise. * gcc.dg/ipa/ipa-7.c: Likewise. From-SVN: r157254 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 82618ad8a290..7943aa8dc521 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,20 @@ +2010-03-05 Kaveh R. Ghazi + + Backport: + 2009-10-15 Kaveh R. Ghazi + * lib/target-supports.exp (add_options_for_bind_pic_locally): New. + + 2009-10-16 Kaveh R. Ghazi + * g++.dg/other/first-global.C: Use dg-add-options bind_pic_locally. + * g++.dg/parse/attr-externally-visible-1.C: Likewise. + * g++.dg/tree-ssa/nothrow-1.C: Likewise. + * gcc.dg/ipa/ipa-1.c: Likewise. + * gcc.dg/ipa/ipa-2.c: Likewise. + * gcc.dg/ipa/ipa-3.c: Likewise. + * gcc.dg/ipa/ipa-4.c: Likewise. + * gcc.dg/ipa/ipa-5.c: Likewise. + * gcc.dg/ipa/ipa-7.c: Likewise. + 2010-02-16 Paolo Bonzini * gcc.c-torture/execute/pr41917.c: New test. diff --git a/gcc/testsuite/g++.dg/other/first-global.C b/gcc/testsuite/g++.dg/other/first-global.C index a993a9d51755..0f39a8abb732 100644 --- a/gcc/testsuite/g++.dg/other/first-global.C +++ b/gcc/testsuite/g++.dg/other/first-global.C @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-fpie" { target { ! nonpic } } } */ +/* { dg-add-options bind_pic_locally } */ /* { dg-final { scan-assembler "_GLOBAL__I(_|_65535_0_)foobar" } } */ struct foo { foo (); }; diff --git a/gcc/testsuite/g++.dg/parse/attr-externally-visible-1.C b/gcc/testsuite/g++.dg/parse/attr-externally-visible-1.C index dbdab88af2d2..845d873aacb7 100644 --- a/gcc/testsuite/g++.dg/parse/attr-externally-visible-1.C +++ b/gcc/testsuite/g++.dg/parse/attr-externally-visible-1.C @@ -1,6 +1,6 @@ // { dg-do compile } // { dg-options "-O3 -fwhole-program" } -// { dg-options "-O3 -fwhole-program -fpie" { target { ! nonpic } } } +// { dg-add-options bind_pic_locally } // { dg-final { scan-assembler "foo1" } } // { dg-final { scan-assembler "foo2" } } // { dg-final { scan-assembler "foo3" } } diff --git a/gcc/testsuite/g++.dg/tree-ssa/nothrow-1.C b/gcc/testsuite/g++.dg/tree-ssa/nothrow-1.C index 4bb71589de36..33462946aed5 100644 --- a/gcc/testsuite/g++.dg/tree-ssa/nothrow-1.C +++ b/gcc/testsuite/g++.dg/tree-ssa/nothrow-1.C @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O1 -fdump-tree-cfg" } */ -/* { dg-skip-if "" { "*-*-*" } { "-fpic" "-fPIC" } { "" } } */ +/* { dg-add-options bind_pic_locally } */ + double a; void t() { diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-1.c b/gcc/testsuite/gcc.dg/ipa/ipa-1.c index 65fd7b8ba718..4ec30c68ffc7 100644 --- a/gcc/testsuite/gcc.dg/ipa/ipa-1.c +++ b/gcc/testsuite/gcc.dg/ipa/ipa-1.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O3 -fipa-cp -fdump-ipa-cp -fno-early-inlining" } */ -/* { dg-skip-if "PR 25442" { "*-*-*" } { "-fpic" "-fPIC" } { "" } } */ +/* { dg-add-options bind_pic_locally } */ #include int g (int b, int c) diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-2.c b/gcc/testsuite/gcc.dg/ipa/ipa-2.c index 281c457eb362..d0896aa35bb2 100644 --- a/gcc/testsuite/gcc.dg/ipa/ipa-2.c +++ b/gcc/testsuite/gcc.dg/ipa/ipa-2.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O3 -fipa-cp -fdump-ipa-cp -fno-early-inlining" } */ -/* { dg-skip-if "PR 25442" { "*-*-*" } { "-fpic" "-fPIC" } { "" } } */ +/* { dg-add-options bind_pic_locally } */ #include int g (int b, int c) diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-3.c b/gcc/testsuite/gcc.dg/ipa/ipa-3.c index 9487aae7f3b9..0c905df6c024 100644 --- a/gcc/testsuite/gcc.dg/ipa/ipa-3.c +++ b/gcc/testsuite/gcc.dg/ipa/ipa-3.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O3 -fipa-cp -fdump-ipa-cp -fno-early-inlining" } */ -/* { dg-skip-if "PR 25442" { "*-*-*" } { "-fpic" "-fPIC" } { "" } } */ +/* { dg-add-options bind_pic_locally } */ /* Double constants. */ diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-4.c b/gcc/testsuite/gcc.dg/ipa/ipa-4.c index 55599a240489..f3ce4279de5d 100644 --- a/gcc/testsuite/gcc.dg/ipa/ipa-4.c +++ b/gcc/testsuite/gcc.dg/ipa/ipa-4.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O3 -fipa-cp -fdump-ipa-cp" } */ -/* { dg-skip-if "PR 25442" { "*-*-*" } { "-fpic" "-fPIC" } { "" } } */ +/* { dg-add-options bind_pic_locally } */ #include int g (int b, int c) diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-5.c b/gcc/testsuite/gcc.dg/ipa/ipa-5.c index b5106d953434..a3fa95f90c79 100644 --- a/gcc/testsuite/gcc.dg/ipa/ipa-5.c +++ b/gcc/testsuite/gcc.dg/ipa/ipa-5.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O3 -fipa-cp -fdump-ipa-cp -fno-early-inlining" } */ -/* { dg-skip-if "PR 25442" { "*-*-*" } { "-fpic" "-fPIC" } { "" } } */ +/* { dg-add-options bind_pic_locally } */ /* Float & short constants. */ diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-7.c b/gcc/testsuite/gcc.dg/ipa/ipa-7.c index 60fc9c0b06f9..5aadb37543a3 100644 --- a/gcc/testsuite/gcc.dg/ipa/ipa-7.c +++ b/gcc/testsuite/gcc.dg/ipa/ipa-7.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O3 -fipa-cp -fdump-ipa-cp -fno-early-inlining" } */ -/* { dg-skip-if "PR 25442" { "*-*-*" } { "-fpic" "-fPIC" } { "" } } */ +/* { dg-add-options bind_pic_locally } */ #include void send_addr (int *); diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index ab9886f2ef00..924973234ca0 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -2356,6 +2356,28 @@ proc add_options_for_c99_runtime { flags } { return $flags } +# Add to FLAGS the flags needed to enable functions to bind locally +# when using pic/PIC passes in the testsuite. + +proc add_options_for_bind_pic_locally { flags } { + if {[check_no_compiler_messages using_pic2 assembly { + #if __PIC__ != 2 + #error FOO + #endif + }]} { + return "$flags -fPIE" + } + if {[check_no_compiler_messages using_pic1 assembly { + #if __PIC__ != 1 + #error FOO + #endif + }]} { + return "$flags -fpie" + } + + return $flags +} + # Return 1 if the target provides a full C99 runtime. proc check_effective_target_c99_runtime { } {