target-supports.exp (add_options_for_bind_pic_locally): New.
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>
Thu, 15 Oct 2009 18:09:59 +0000 (18:09 +0000)
committerKaveh Ghazi <ghazi@gcc.gnu.org>
Thu, 15 Oct 2009 18:09:59 +0000 (18:09 +0000)
* lib/target-supports.exp (add_options_for_bind_pic_locally): New.
* gcc.dg/tree-ssa/ipa-cp-1.c: Bind pic locally.

From-SVN: r152857

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/ipa-cp-1.c
gcc/testsuite/lib/target-supports.exp

index b54a6e0e3bcc4d38311e47ddbd95e9439567e0f4..4129a3e3aa0be4c1c8bf52caeac0ac0215d14126 100644 (file)
@@ -1,3 +1,8 @@
+2009-10-15  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * lib/target-supports.exp (add_options_for_bind_pic_locally): New.
+       * gcc.dg/tree-ssa/ipa-cp-1.c: Bind pic locally.
+
 2009-10-15  Richard Guenther  <rguenther@suse.de>
 
        PR lto/41669
index 5f126363124196ce357d37cd3cca2ff4699149bb..b9c67a6260976868b874d533676dae8c5b21edbc 100644 (file)
@@ -1,5 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-O3 -fdump-tree-optimized -fno-inline" } */
+/* { dg-add-options bind_pic_locally } */
+
 int
 very_long_function(int a)
 {
index c287cec85bbd9bf9285edd66ac16ee4a9a5a1ddf..f8e83ec0988a69a81c3b07fe86ea7723ca57fc94 100644 (file)
@@ -2984,6 +2984,28 @@ proc add_options_for_ieee { 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 { } {