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

2014-01-09 Thread Vidya Praveen
On Wed, Jan 08, 2014 at 12:28:56PM +, Jakub Jelinek wrote:
 On Wed, Jan 08, 2014 at 11:49:08AM +, Vidya Praveen wrote:
  On Tue, Jan 07, 2014 at 09:35:54PM +, Mike Stump wrote:
   On Dec 17, 2013, at 6:06 AM, Vidya Praveen vidyaprav...@arm.com wrote:
bind_pic_locally is broken for targets that doesn't pass -fPIC/-fpic by
default [1][2].
   
   Let's give Jakub 2 days to weigh in?  If no objections, Ok, though, do 
   see about adding documentation for it.  
  
  Sure. I didn't respin the patch with documentation since I wanted to know
  if the solution is acceptable. If this patch is OK, I'll respin with the
  documentation for bind_pic_locally_ok. 
  
   I kinda would like a simpler interface for these two, but?  that can be 
   follow on work, if someone has a bright idea and some time to implement 
   it.
   
  
  Could you explain what do you mean by simpler interface here? 
 
 The simpler interface, as I said earlier, would be just to make sure
 /* { dg-add-options bind_pic_locally } */
 does the right thing, I really don't believe you've tried hard enough.
 
 It is true dejagnu's default_target_compile has:
 if {[board_info $dest exists multilib_flags]} {
 append add_flags  [board_info $dest multilib_flags]
 }
 last (before just adding -o $destfile; is multilib_flags where the
 -fpic/-fPIC comes in, right?), but if say dg-add-options bind_pic_locally
 adds the necessary options not to dg-extra-tools-flags, but to some
 other variable and say gcc_target_compile (and g++_target_compile)
 around the [target_compile ...] invocation e.g. temporarily append
 that other variable (if not empty) to board_info's multilib_flags
 and afterwards remove it, I don't see why it wouldn't work.
 Tcl is quite flexible in this.

Thanks Jakub. I seem to have not properly understood your earlier email. I could
do this and works fine. I'll test and post the patch.

VP.




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

2014-01-08 Thread Vidya Praveen
On Tue, Jan 07, 2014 at 09:35:54PM +, Mike Stump wrote:
 On Dec 17, 2013, at 6:06 AM, Vidya Praveen vidyaprav...@arm.com wrote:
  bind_pic_locally is broken for targets that doesn't pass -fPIC/-fpic by
  default [1][2].
 
 Let's give Jakub 2 days to weigh in?  If no objections, Ok, though, do see 
 about adding documentation for it.  

Sure. I didn't respin the patch with documentation since I wanted to know
if the solution is acceptable. If this patch is OK, I'll respin with the
documentation for bind_pic_locally_ok. 

 I kinda would like a simpler interface for these two, but?  that can be 
 follow on work, if someone has a bright idea and some time to implement it.
 

Could you explain what do you mean by simpler interface here? 

Cheers
VP.




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

2014-01-08 Thread Jakub Jelinek
On Wed, Jan 08, 2014 at 11:49:08AM +, Vidya Praveen wrote:
 On Tue, Jan 07, 2014 at 09:35:54PM +, Mike Stump wrote:
  On Dec 17, 2013, at 6:06 AM, Vidya Praveen vidyaprav...@arm.com wrote:
   bind_pic_locally is broken for targets that doesn't pass -fPIC/-fpic by
   default [1][2].
  
  Let's give Jakub 2 days to weigh in?  If no objections, Ok, though, do see 
  about adding documentation for it.  
 
 Sure. I didn't respin the patch with documentation since I wanted to know
 if the solution is acceptable. If this patch is OK, I'll respin with the
 documentation for bind_pic_locally_ok. 
 
  I kinda would like a simpler interface for these two, but?  that can be 
  follow on work, if someone has a bright idea and some time to implement it.
  
 
 Could you explain what do you mean by simpler interface here? 

The simpler interface, as I said earlier, would be just to make sure
/* { dg-add-options bind_pic_locally } */
does the right thing, I really don't believe you've tried hard enough.

It is true dejagnu's default_target_compile has:
if {[board_info $dest exists multilib_flags]} {
append add_flags  [board_info $dest multilib_flags]
}
last (before just adding -o $destfile; is multilib_flags where the
-fpic/-fPIC comes in, right?), but if say dg-add-options bind_pic_locally
adds the necessary options not to dg-extra-tools-flags, but to some
other variable and say gcc_target_compile (and g++_target_compile)
around the [target_compile ...] invocation e.g. temporarily append
that other variable (if not empty) to board_info's multilib_flags
and afterwards remove it, I don't see why it wouldn't work.
Tcl is quite flexible in this.

Jakub


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

2014-01-07 Thread Vidya Praveen
Ping!

On Tue, Dec 17, 2013 at 02:06:13PM +, 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  vidyaprav...@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 } 

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

2014-01-07 Thread Mike Stump
On Jan 7, 2014, at 12:21 PM, Vidya Praveen vidyaprav...@arm.com wrote:
 Ping!

?

We're confused, didn't someone say:

 Hi Vidya,
 
  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].
 
 if this patch is to go in, it needs documentation for the new keyword in
 gcc/doc/sourcebuild.texi.
 
   Rainer

about this work already?

 On Tue, Dec 17, 2013 at 02:06:13PM +, Vidya Praveen wrote:
 Hello,
 
 bind_pic_locally is broken for targets that doesn't pass -fPIC/-fpic by
 default [1][2].

If so, and that applies to the patch you sent, then that was a formal Ok.  The 
request was that you also document it.



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

2014-01-07 Thread Mike Stump
On Jan 7, 2014, at 1:22 PM, Mike Stump mikest...@comcast.net wrote:
 On Jan 7, 2014, at 12:21 PM, Vidya Praveen vidyaprav...@arm.com wrote:
 Ping!
 
 ?

 We're confused, didn't someone say:

See, I was confused… I misread that…  sorry.



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

2014-01-07 Thread Mike Stump
On Dec 17, 2013, at 6:06 AM, Vidya Praveen vidyaprav...@arm.com wrote:
 bind_pic_locally is broken for targets that doesn't pass -fPIC/-fpic by
 default [1][2].

Let's give Jakub 2 days to weigh in…  If no objections, Ok, though, do see 
about adding documentation for it.  I kinda would like a simpler interface for 
these two, but…  that can be follow on work, if someone has a bright idea and 
some time to implement it.

[Patch,testsuite] Fix testcases that use bind_pic_locally

2013-12-17 Thread Vidya Praveen
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  vidyaprav...@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  

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

2013-12-17 Thread Rainer Orth
Hi Vidya,

 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].

if this patch is to go in, it needs documentation for the new keyword in
gcc/doc/sourcebuild.texi.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University