This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch,testsuite] Fix testcases that use bind_pic_locally


Ping!

On Tue, Dec 17, 2013 at 02:06:13PM +0000, Vidya Praveen wrote:
> Hello,
> 
> bind_pic_locally is broken for targets that doesn't pass -fPIC/-fpic by
> default [1][2].
> 
> One of the suggestions was to have a effective target check called
> bind_pic_locally_ok which checks if bind_pic_locally will work and have it
> included in all the tests that uses bind_pic_locally in dg-add-options [1].
> 
> This patch implements the same by checking if -fpic/-fPIC are passed by
> default as well in general with the flags passed through various means. It
> returns 1 when either the -fpic/-fPIC is passed by default OR when it is 
> not passed by default as well as not passed through any other means. This 
> however, will allow if -fpic/-fPIC is passed both by default and by the 
> other means since we can't really tell such a case and it makes no sense 
> to do so (because there's no reason for the testcase to pass -fPIC/-fpic 
> when it tries to override the same using bind_pic_locally and if it is 
> passed by default, there's no need to pass them through, say, board file's
> cflags).
> 
> default  other-means  returns
> pic		-	1
> pic		pic	1 (invalid)
> -		pic	0
> -		-	1
> 
> This patch also modifies all the testcases that use bind_pic_locally to 
> include this bind_pic_locally_ok check.
> 
> Tested for aarch64-none-elf, arm-none-eabi, arm-none-linux-gnueabihf.
> 
> OK?
> 
> Cheers
> VP.
> 
> [1] http://gcc.gnu.org/ml/gcc/2013-09/msg00207.html
> [2] http://gcc.gnu.org/ml/gcc-patches/2013-10/msg00462.html
> 
> 
> gcc/testsuite/ChangeLog:
> 
> 2013-12-17  Vidya Praveen  <vidyapraveen@arm.com>
> 
> 	* lib/target-support.exp: (check_effective_target_bind_pic_locally_ok):
> 	New check.
> 	* g++.dg/ipa/iinline-1.C: Introduce bind_pic_locally_ok.
> 	* g++.dg/ipa/iinline-2.C: Likewise.
> 	* g++.dg/ipa/iinline-3.C: Likewise.
> 	* g++.dg/ipa/inline-1.C: Likewise.
> 	* g++.dg/ipa/inline-2.C: Likewise.
> 	* g++.dg/ipa/inline-3.C: Likewise.
> 	* g++.dg/other/first-global.C: Likewise.
> 	* g++.dg/parse/attr-externally-visible-1.C: Likewise.
> 	* g++.dg/torture/pr40323.C: Likewise.
> 	* g++.dg/torture/pr55260-1.C: Likewise.
> 	* g++.dg/torture/pr55260-2.C: Likewise.
> 	* g++.dg/tree-ssa/inline-1.C: Likewise.
> 	* g++.dg/tree-ssa/inline-2.C: Likewise.
> 	* g++.dg/tree-ssa/inline-3.C: Likewise.
> 	* g++.dg/tree-ssa/nothrow-1.C: Likewise.
> 	* gcc.dg/inline-33.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.
> 	* gcc.dg/ipa/ipa-8.c: Likewise.
> 	* gcc.dg/ipa/ipacost-2.c: Likewise.
> 	* gcc.dg/ipa/ipcp-1.c: Likewise.
> 	* gcc.dg/ipa/ipcp-2.c: Likewise.
> 	* gcc.dg/ipa/ipcp-4.c: Likewise.
> 	* gcc.dg/ipa/ipcp-agg-1.c: Likewise.
> 	* gcc.dg/ipa/ipcp-agg-2.c: Likewise.
> 	* gcc.dg/ipa/ipcp-agg-3.c: Likewise.
> 	* gcc.dg/ipa/ipcp-agg-4.c: Likewise.
> 	* gcc.dg/ipa/ipcp-agg-5.c: Likewise.
> 	* gcc.dg/ipa/ipcp-agg-6.c: Likewise.
> 	* gcc.dg/ipa/ipcp-agg-7.c: Likewise.
> 	* gcc.dg/ipa/ipcp-agg-8.c: Likewise.
> 	* gcc.dg/ipa/pr56988.c: Likewise.
> 	* gcc.dg/tree-ssa/inline-3.c: Likewise.
> 	* gcc.dg/tree-ssa/inline-4.c: Likewise.
> 	* gcc.dg/tree-ssa/ipa-cp-1.c: Likewise.
> 	* gcc.dg/tree-ssa/local-pure-const.c: Likewise.
> 	* gfortran.dg/whole_file_5.f90: Likewise.
> 	* gfortran.dg/whole_file_6.f90: Likewise.
> 

> diff --git a/gcc/testsuite/g++.dg/ipa/iinline-1.C b/gcc/testsuite/g++.dg/ipa/iinline-1.C
> index 9f99893..b86daf1 100644
> --- a/gcc/testsuite/g++.dg/ipa/iinline-1.C
> +++ b/gcc/testsuite/g++.dg/ipa/iinline-1.C
> @@ -1,6 +1,7 @@
>  /* Verify that simple indirect calls are inlined even without early
>     inlining..  */
>  /* { dg-do compile } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-options "-O3 -fdump-ipa-inline -fno-early-inlining"  } */
>  /* { dg-add-options bind_pic_locally } */
>  
> diff --git a/gcc/testsuite/g++.dg/ipa/iinline-2.C b/gcc/testsuite/g++.dg/ipa/iinline-2.C
> index 670a5dd..d4329c1 100644
> --- a/gcc/testsuite/g++.dg/ipa/iinline-2.C
> +++ b/gcc/testsuite/g++.dg/ipa/iinline-2.C
> @@ -1,6 +1,7 @@
>  /* Verify that simple indirect calls are inlined even without early
>     inlining..  */
>  /* { dg-do compile } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-options "-O3 -fdump-ipa-inline -fno-early-inlining"  } */
>  /* { dg-add-options bind_pic_locally } */
>  
> diff --git a/gcc/testsuite/g++.dg/ipa/iinline-3.C b/gcc/testsuite/g++.dg/ipa/iinline-3.C
> index 3daee9a..4dc604e 100644
> --- a/gcc/testsuite/g++.dg/ipa/iinline-3.C
> +++ b/gcc/testsuite/g++.dg/ipa/iinline-3.C
> @@ -1,6 +1,7 @@
>  /* Verify that we do not indirect-inline using member pointer
>     parameters which have been modified.  */
>  /* { dg-do run } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-options "-O3 -fno-early-inlining"  } */
>  /* { dg-add-options bind_pic_locally } */
>  
> diff --git a/gcc/testsuite/g++.dg/ipa/inline-1.C b/gcc/testsuite/g++.dg/ipa/inline-1.C
> index dbbfb4e..1800dc2 100644
> --- a/gcc/testsuite/g++.dg/ipa/inline-1.C
> +++ b/gcc/testsuite/g++.dg/ipa/inline-1.C
> @@ -1,4 +1,5 @@
>  /* { dg-do compile } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-options "-O2 -fdump-ipa-inline --param max-early-inliner-iterations=1" } */
>  /* { dg-add-options bind_pic_locally } */
>  
> diff --git a/gcc/testsuite/g++.dg/ipa/inline-2.C b/gcc/testsuite/g++.dg/ipa/inline-2.C
> index fd284a1e2..d84e486 100644
> --- a/gcc/testsuite/g++.dg/ipa/inline-2.C
> +++ b/gcc/testsuite/g++.dg/ipa/inline-2.C
> @@ -1,4 +1,5 @@
>  /* { dg-do compile } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-options "-O2 -fdump-ipa-inline --param max-early-inliner-iterations=1" } */
>  /* { dg-add-options bind_pic_locally } */
>  
> diff --git a/gcc/testsuite/g++.dg/ipa/inline-3.C b/gcc/testsuite/g++.dg/ipa/inline-3.C
> index 8d5f905..1aac700 100644
> --- a/gcc/testsuite/g++.dg/ipa/inline-3.C
> +++ b/gcc/testsuite/g++.dg/ipa/inline-3.C
> @@ -1,4 +1,5 @@
>  /* { dg-do compile } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-options "-O2 -fdump-ipa-inline --param max-early-inliner-iterations=1" } */
>  /* { dg-add-options bind_pic_locally } */
>  
> diff --git a/gcc/testsuite/g++.dg/other/first-global.C b/gcc/testsuite/g++.dg/other/first-global.C
> index d58bc71..4347e86 100644
> --- a/gcc/testsuite/g++.dg/other/first-global.C
> +++ b/gcc/testsuite/g++.dg/other/first-global.C
> @@ -1,4 +1,5 @@
>  /* { dg-do compile } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-add-options bind_pic_locally } */
>  /* { dg-final { scan-assembler "_GLOBAL__(I|sub_I)(_|_65535_0_)foobar" } } */
>  
> 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 845d873..9f27a0e 100644
> --- a/gcc/testsuite/g++.dg/parse/attr-externally-visible-1.C
> +++ b/gcc/testsuite/g++.dg/parse/attr-externally-visible-1.C
> @@ -1,4 +1,5 @@
>  // { dg-do compile }
> +// { dg-require-effective-target bind_pic_locally_ok }
>  // { dg-options "-O3 -fwhole-program" }
>  // { dg-add-options bind_pic_locally }
>  // { dg-final { scan-assembler "foo1" } }
> diff --git a/gcc/testsuite/g++.dg/torture/pr40323.C b/gcc/testsuite/g++.dg/torture/pr40323.C
> index c7ffcb5..b5af987 100644
> --- a/gcc/testsuite/g++.dg/torture/pr40323.C
> +++ b/gcc/testsuite/g++.dg/torture/pr40323.C
> @@ -1,5 +1,6 @@
>  /* Testcase for PR 40323.  */
>  /* { dg-do compile } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-options "-fno-early-inlining"  } */
>  /* { dg-add-options bind_pic_locally } */
>  
> diff --git a/gcc/testsuite/g++.dg/torture/pr55260-1.C b/gcc/testsuite/g++.dg/torture/pr55260-1.C
> index 552da8d..579b0ba 100644
> --- a/gcc/testsuite/g++.dg/torture/pr55260-1.C
> +++ b/gcc/testsuite/g++.dg/torture/pr55260-1.C
> @@ -1,4 +1,5 @@
>  /* { dg-do compile } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-options "-std=gnu++0x -fno-inline" } */
>  /* { dg-add-options bind_pic_locally } */
>  
> diff --git a/gcc/testsuite/g++.dg/torture/pr55260-2.C b/gcc/testsuite/g++.dg/torture/pr55260-2.C
> index 43ed1e7..f7e21d9 100644
> --- a/gcc/testsuite/g++.dg/torture/pr55260-2.C
> +++ b/gcc/testsuite/g++.dg/torture/pr55260-2.C
> @@ -1,4 +1,5 @@
>  /* { dg-do compile } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-add-options bind_pic_locally } */
>  
>  struct B
> diff --git a/gcc/testsuite/g++.dg/tree-ssa/inline-1.C b/gcc/testsuite/g++.dg/tree-ssa/inline-1.C
> index d8682be..071db4c 100644
> --- a/gcc/testsuite/g++.dg/tree-ssa/inline-1.C
> +++ b/gcc/testsuite/g++.dg/tree-ssa/inline-1.C
> @@ -1,4 +1,5 @@
>  /* { dg-do compile } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-options "-O2 -fdump-tree-einline --param max-early-inliner-iterations=3" } */
>  /* { dg-add-options bind_pic_locally } */
>  
> diff --git a/gcc/testsuite/g++.dg/tree-ssa/inline-2.C b/gcc/testsuite/g++.dg/tree-ssa/inline-2.C
> index 4c8a626..087e578 100644
> --- a/gcc/testsuite/g++.dg/tree-ssa/inline-2.C
> +++ b/gcc/testsuite/g++.dg/tree-ssa/inline-2.C
> @@ -1,4 +1,5 @@
>  /* { dg-do compile } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-options "-O2 -fdump-tree-einline --param max-early-inliner-iterations=3" } */
>  /* { dg-add-options bind_pic_locally } */
>  
> diff --git a/gcc/testsuite/g++.dg/tree-ssa/inline-3.C b/gcc/testsuite/g++.dg/tree-ssa/inline-3.C
> index 2804a63..dcb77c7 100644
> --- a/gcc/testsuite/g++.dg/tree-ssa/inline-3.C
> +++ b/gcc/testsuite/g++.dg/tree-ssa/inline-3.C
> @@ -1,4 +1,5 @@
>  /* { dg-do compile } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-options "-O2 -fdump-tree-einline --param max-early-inliner-iterations=5" } */
>  /* { dg-add-options bind_pic_locally } */
>  
> diff --git a/gcc/testsuite/g++.dg/tree-ssa/nothrow-1.C b/gcc/testsuite/g++.dg/tree-ssa/nothrow-1.C
> index 3346294..f8e894c 100644
> --- a/gcc/testsuite/g++.dg/tree-ssa/nothrow-1.C
> +++ b/gcc/testsuite/g++.dg/tree-ssa/nothrow-1.C
> @@ -1,4 +1,5 @@
>  /* { dg-do compile } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-options "-O1 -fdump-tree-cfg" } */
>  /* { dg-add-options bind_pic_locally } */
>  
> diff --git a/gcc/testsuite/gcc.dg/inline-33.c b/gcc/testsuite/gcc.dg/inline-33.c
> index d82ff71..9304d2d 100644
> --- a/gcc/testsuite/gcc.dg/inline-33.c
> +++ b/gcc/testsuite/gcc.dg/inline-33.c
> @@ -1,4 +1,5 @@
>  /* { dg-do compile } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-options "-O3 -fdump-tree-optimized"  } */
>  /* { dg-add-options bind_pic_locally } */
>  
> diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-1.c b/gcc/testsuite/gcc.dg/ipa/ipa-1.c
> index 3cc32da..4b4c30f 100644
> --- a/gcc/testsuite/gcc.dg/ipa/ipa-1.c
> +++ b/gcc/testsuite/gcc.dg/ipa/ipa-1.c
> @@ -1,4 +1,5 @@
>  /* { dg-do compile } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining"  } */
>  /* { dg-add-options bind_pic_locally } */
>  
> diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-2.c b/gcc/testsuite/gcc.dg/ipa/ipa-2.c
> index 7f14d42..a7e0d68 100644
> --- a/gcc/testsuite/gcc.dg/ipa/ipa-2.c
> +++ b/gcc/testsuite/gcc.dg/ipa/ipa-2.c
> @@ -1,4 +1,5 @@
>  /* { dg-do compile } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining"  } */
>  /* { dg-add-options bind_pic_locally } */
>  
> diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-3.c b/gcc/testsuite/gcc.dg/ipa/ipa-3.c
> index 36fd506..8d071fc 100644
> --- a/gcc/testsuite/gcc.dg/ipa/ipa-3.c
> +++ b/gcc/testsuite/gcc.dg/ipa/ipa-3.c
> @@ -1,4 +1,5 @@
>  /* { dg-do compile } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining"  } */
>  /* { dg-add-options bind_pic_locally } */
>  
> diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-4.c b/gcc/testsuite/gcc.dg/ipa/ipa-4.c
> index 566b329..68b3b7e 100644
> --- a/gcc/testsuite/gcc.dg/ipa/ipa-4.c
> +++ b/gcc/testsuite/gcc.dg/ipa/ipa-4.c
> @@ -1,4 +1,5 @@
>  /* { dg-do compile } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining"  } */
>  /* { dg-add-options bind_pic_locally } */
>  
> diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-5.c b/gcc/testsuite/gcc.dg/ipa/ipa-5.c
> index daa64fa..6388d84 100644
> --- a/gcc/testsuite/gcc.dg/ipa/ipa-5.c
> +++ b/gcc/testsuite/gcc.dg/ipa/ipa-5.c
> @@ -1,4 +1,5 @@
>  /* { dg-do compile } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining"  } */
>  /* { dg-add-options bind_pic_locally } */
>  
> diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-7.c b/gcc/testsuite/gcc.dg/ipa/ipa-7.c
> index 271a34a..a3d384a 100644
> --- a/gcc/testsuite/gcc.dg/ipa/ipa-7.c
> +++ b/gcc/testsuite/gcc.dg/ipa/ipa-7.c
> @@ -1,4 +1,5 @@
>  /* { dg-do compile } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining"  } */
>  /* { dg-add-options bind_pic_locally } */
>  
> diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-8.c b/gcc/testsuite/gcc.dg/ipa/ipa-8.c
> index d138cf2..0ee8072 100644
> --- a/gcc/testsuite/gcc.dg/ipa/ipa-8.c
> +++ b/gcc/testsuite/gcc.dg/ipa/ipa-8.c
> @@ -1,4 +1,5 @@
>  /* { dg-do compile } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining"  } */
>  /* { dg-add-options bind_pic_locally } */
>  
> diff --git a/gcc/testsuite/gcc.dg/ipa/ipacost-2.c b/gcc/testsuite/gcc.dg/ipa/ipacost-2.c
> index ceb524e..9908526 100644
> --- a/gcc/testsuite/gcc.dg/ipa/ipacost-2.c
> +++ b/gcc/testsuite/gcc.dg/ipa/ipacost-2.c
> @@ -1,4 +1,5 @@
>  /* { dg-do compile } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining -fdump-tree-optimized"  } */
>  /* { dg-add-options bind_pic_locally } */
>  
> diff --git a/gcc/testsuite/gcc.dg/ipa/ipcp-1.c b/gcc/testsuite/gcc.dg/ipa/ipcp-1.c
> index a2ffd42..e40002c 100644
> --- a/gcc/testsuite/gcc.dg/ipa/ipcp-1.c
> +++ b/gcc/testsuite/gcc.dg/ipa/ipcp-1.c
> @@ -3,6 +3,7 @@
>     accordinly.  */
>  
>  /* { dg-do compile } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining"  } */
>  /* { dg-add-options bind_pic_locally } */
>  
> diff --git a/gcc/testsuite/gcc.dg/ipa/ipcp-2.c b/gcc/testsuite/gcc.dg/ipa/ipcp-2.c
> index 62f564f..4c2a420 100644
> --- a/gcc/testsuite/gcc.dg/ipa/ipcp-2.c
> +++ b/gcc/testsuite/gcc.dg/ipa/ipcp-2.c
> @@ -1,4 +1,5 @@
>  /* { dg-do compile } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining"  } */
>  /* { dg-add-options bind_pic_locally } */
>  
> diff --git a/gcc/testsuite/gcc.dg/ipa/ipcp-4.c b/gcc/testsuite/gcc.dg/ipa/ipcp-4.c
> index 462cade..18d930b 100644
> --- a/gcc/testsuite/gcc.dg/ipa/ipcp-4.c
> +++ b/gcc/testsuite/gcc.dg/ipa/ipcp-4.c
> @@ -3,6 +3,7 @@
>     cloned.  */
>  
>  /* { dg-do compile } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining"  } */
>  /* { dg-add-options bind_pic_locally } */
>  
> diff --git a/gcc/testsuite/gcc.dg/ipa/ipcp-agg-1.c b/gcc/testsuite/gcc.dg/ipa/ipcp-agg-1.c
> index b2e04f8..747f465 100644
> --- a/gcc/testsuite/gcc.dg/ipa/ipcp-agg-1.c
> +++ b/gcc/testsuite/gcc.dg/ipa/ipcp-agg-1.c
> @@ -1,4 +1,5 @@
>  /* { dg-do compile } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-options "-O3 -fno-ipa-sra -fdump-ipa-cp-details -fdump-tree-optimized-slim"  } */
>  /* { dg-add-options bind_pic_locally } */
>  
> diff --git a/gcc/testsuite/gcc.dg/ipa/ipcp-agg-2.c b/gcc/testsuite/gcc.dg/ipa/ipcp-agg-2.c
> index 7edfa40..e8818b0 100644
> --- a/gcc/testsuite/gcc.dg/ipa/ipcp-agg-2.c
> +++ b/gcc/testsuite/gcc.dg/ipa/ipcp-agg-2.c
> @@ -1,4 +1,5 @@
>  /* { dg-do compile } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-options "-O3 -fno-ipa-sra -fdump-ipa-cp-details -fdump-tree-optimized-slim"  } */
>  /* { dg-add-options bind_pic_locally } */
>  
> diff --git a/gcc/testsuite/gcc.dg/ipa/ipcp-agg-3.c b/gcc/testsuite/gcc.dg/ipa/ipcp-agg-3.c
> index 4c0a3e7..e230539 100644
> --- a/gcc/testsuite/gcc.dg/ipa/ipcp-agg-3.c
> +++ b/gcc/testsuite/gcc.dg/ipa/ipcp-agg-3.c
> @@ -1,4 +1,5 @@
>  /* { dg-do compile } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-options "-O3 -fno-ipa-sra -fdump-ipa-cp-details -fdump-tree-optimized-slim"  } */
>  /* { dg-add-options bind_pic_locally } */
>  
> diff --git a/gcc/testsuite/gcc.dg/ipa/ipcp-agg-4.c b/gcc/testsuite/gcc.dg/ipa/ipcp-agg-4.c
> index 1c1da4d..d143d01 100644
> --- a/gcc/testsuite/gcc.dg/ipa/ipcp-agg-4.c
> +++ b/gcc/testsuite/gcc.dg/ipa/ipcp-agg-4.c
> @@ -1,4 +1,5 @@
>  /* { dg-do compile } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-options "-O3 -fno-ipa-sra -fdump-ipa-cp-details -fdump-tree-optimized-slim"  } */
>  /* { dg-add-options bind_pic_locally } */
>  
> diff --git a/gcc/testsuite/gcc.dg/ipa/ipcp-agg-5.c b/gcc/testsuite/gcc.dg/ipa/ipcp-agg-5.c
> index 9f6ee5b..d3403c3 100644
> --- a/gcc/testsuite/gcc.dg/ipa/ipcp-agg-5.c
> +++ b/gcc/testsuite/gcc.dg/ipa/ipcp-agg-5.c
> @@ -1,4 +1,5 @@
>  /* { dg-do compile } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-options "-O3 -fno-ipa-sra -fdump-ipa-cp-details -fdump-tree-optimized-slim"  } */
>  /* { dg-add-options bind_pic_locally } */
>  
> diff --git a/gcc/testsuite/gcc.dg/ipa/ipcp-agg-6.c b/gcc/testsuite/gcc.dg/ipa/ipcp-agg-6.c
> index 050e13b..325da37 100644
> --- a/gcc/testsuite/gcc.dg/ipa/ipcp-agg-6.c
> +++ b/gcc/testsuite/gcc.dg/ipa/ipcp-agg-6.c
> @@ -1,4 +1,5 @@
>  /* { dg-do compile } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-options "-O3 -fno-ipa-sra -fdump-ipa-cp-details -fdump-tree-optimized-slim"  } */
>  /* { dg-add-options bind_pic_locally } */
>  
> diff --git a/gcc/testsuite/gcc.dg/ipa/ipcp-agg-7.c b/gcc/testsuite/gcc.dg/ipa/ipcp-agg-7.c
> index e85ca1a..d41abef 100644
> --- a/gcc/testsuite/gcc.dg/ipa/ipcp-agg-7.c
> +++ b/gcc/testsuite/gcc.dg/ipa/ipcp-agg-7.c
> @@ -1,4 +1,5 @@
>  /* { dg-do compile } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-options "-O3 -fno-ipa-sra -fdump-ipa-cp-details -fdump-tree-optimized-slim"  } */
>  /* { dg-add-options bind_pic_locally } */
>  
> diff --git a/gcc/testsuite/gcc.dg/ipa/ipcp-agg-8.c b/gcc/testsuite/gcc.dg/ipa/ipcp-agg-8.c
> index 5014ffd..48ddc33 100644
> --- a/gcc/testsuite/gcc.dg/ipa/ipcp-agg-8.c
> +++ b/gcc/testsuite/gcc.dg/ipa/ipcp-agg-8.c
> @@ -1,4 +1,5 @@
>  /* { dg-do compile } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-options "-O3 -fno-ipa-sra -fdump-tree-optimized-slim"  } */
>  /* { dg-add-options bind_pic_locally } */
>  
> diff --git a/gcc/testsuite/gcc.dg/ipa/pr56988.c b/gcc/testsuite/gcc.dg/ipa/pr56988.c
> index ab20159..674ffb7 100644
> --- a/gcc/testsuite/gcc.dg/ipa/pr56988.c
> +++ b/gcc/testsuite/gcc.dg/ipa/pr56988.c
> @@ -1,4 +1,5 @@
>  /* { dg-do run } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-options "-O3" } */
>  /* { dg-add-options bind_pic_locally } */
>  
> diff --git a/gcc/testsuite/gcc.dg/tree-ssa/inline-3.c b/gcc/testsuite/gcc.dg/tree-ssa/inline-3.c
> index 35c3ebb..2ebc765 100644
> --- a/gcc/testsuite/gcc.dg/tree-ssa/inline-3.c
> +++ b/gcc/testsuite/gcc.dg/tree-ssa/inline-3.c
> @@ -1,4 +1,5 @@
>  /* { dg-do compile } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-options "-O2 -fdump-tree-einline --param max-early-inliner-iterations=2" } */
>  /* { dg-add-options bind_pic_locally } */
>  
> diff --git a/gcc/testsuite/gcc.dg/tree-ssa/inline-4.c b/gcc/testsuite/gcc.dg/tree-ssa/inline-4.c
> index 1e700ef..00f279a 100644
> --- a/gcc/testsuite/gcc.dg/tree-ssa/inline-4.c
> +++ b/gcc/testsuite/gcc.dg/tree-ssa/inline-4.c
> @@ -1,4 +1,5 @@
>  /* { dg-do compile } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-options "-O2 -fdump-tree-einline" } */
>  /* { dg-add-options bind_pic_locally } */
>  
> diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ipa-cp-1.c b/gcc/testsuite/gcc.dg/tree-ssa/ipa-cp-1.c
> index ec628b7..9deaee8 100644
> --- a/gcc/testsuite/gcc.dg/tree-ssa/ipa-cp-1.c
> +++ b/gcc/testsuite/gcc.dg/tree-ssa/ipa-cp-1.c
> @@ -1,4 +1,5 @@
>  /* { dg-do compile } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-options "-O3 -fdump-tree-optimized -fno-inline" } */
>  /* { dg-add-options bind_pic_locally } */
>  
> diff --git a/gcc/testsuite/gcc.dg/tree-ssa/local-pure-const.c b/gcc/testsuite/gcc.dg/tree-ssa/local-pure-const.c
> index afb7ca4..0154fd9 100644
> --- a/gcc/testsuite/gcc.dg/tree-ssa/local-pure-const.c
> +++ b/gcc/testsuite/gcc.dg/tree-ssa/local-pure-const.c
> @@ -1,4 +1,5 @@
>  /* { dg-do compile } */
> +/* { dg-require-effective-target bind_pic_locally_ok } */
>  /* { dg-options "-O1 -fdump-tree-local-pure-const1" } */
>  /* { dg-add-options bind_pic_locally } */
>  
> diff --git a/gcc/testsuite/gfortran.dg/whole_file_5.f90 b/gcc/testsuite/gfortran.dg/whole_file_5.f90
> index 34240c9..7bc5c56 100644
> --- a/gcc/testsuite/gfortran.dg/whole_file_5.f90
> +++ b/gcc/testsuite/gfortran.dg/whole_file_5.f90
> @@ -1,4 +1,5 @@
>  ! { dg-do compile }
> +! { dg-require-effective-target bind_pic_locally_ok }
>  ! { dg-options "-O3 -fwhole-file -fdump-tree-optimized" }
>  ! { dg-add-options bind_pic_locally }
>  !
> diff --git a/gcc/testsuite/gfortran.dg/whole_file_6.f90 b/gcc/testsuite/gfortran.dg/whole_file_6.f90
> index 1d92bc3..a1d86dd 100644
> --- a/gcc/testsuite/gfortran.dg/whole_file_6.f90
> +++ b/gcc/testsuite/gfortran.dg/whole_file_6.f90
> @@ -1,4 +1,5 @@
>  ! { dg-do compile }
> +! { dg-require-effective-target bind_pic_locally_ok }
>  ! { dg-options "-O3 -fwhole-file -fdump-tree-optimized" }
>  ! { dg-add-options bind_pic_locally }
>  !
> diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
> index 104818d..a0bfb40 100644
> --- a/gcc/testsuite/lib/target-supports.exp
> +++ b/gcc/testsuite/lib/target-supports.exp
> @@ -2369,6 +2369,50 @@ proc check_effective_target_arm_neon_fp16_ok_nocache { } {
>      return 0
>  }
>  
> +proc check_effective_target_bind_pic_locally_ok { } {
> +    if { [board_info target exists compiler] } {
> +        set compiler [board_info target compiler]
> +    } else {
> +        set compiler "[find_gcc]"
> +    }
> +
> +    # Check if -fpic/-fPIC is passed by default
> +    set name "picasdefault"
> +    set src ${name}[pid].c
> +    set out ${name}[pid].s
> +    set f [open $src "w"]
> +    puts $f "#ifdef __PIC__"
> +    puts $f "#error pic"
> +    puts $f "#endif"
> +    close $f
> +
> +    set status [remote_exec host $compiler "-S $src -o $out"]
> +    if { [lindex $status 0] == 0 } {
> +        set pic_is_default 0
> +    } else {
> +        set pic_is_default 1
> +    }
> +    file delete $src
> +    file delete $out
> +
> +    # Check if -fpic/-fPIC is passed in general
> +    if {[check_no_compiler_messages picused assembly {
> +    #ifdef __PIC__
> +    #error FOO
> +    #endif
> +    }]} {
> +        set pic_is_passed 0
> +    } else {
> +        set pic_is_passed 1
> +    }
> +
> +    if { ($pic_is_default) || (!$pic_is_default && !$pic_is_passed) } {
> +       return 1
> +    }
> +
> +   return 0
> +}
> +
>  proc check_effective_target_arm_neon_fp16_ok { } {
>      return [check_cached_effective_target arm_neon_fp16_ok \
>  		check_effective_target_arm_neon_fp16_ok_nocache]



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]