aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ipa-cp-1.c2
-rw-r--r--gcc/testsuite/lib/target-supports.exp22
3 files changed, 29 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b54a6e0..4129a3e 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
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 5f12636..b9c67a6 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ipa-cp-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ipa-cp-1.c
@@ -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)
{
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index c287cec..f8e83ec0 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -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 { } {