From fc5e3cd436d97e82a45a6966585c9daf9b56f2ea Mon Sep 17 00:00:00 2001 From: "Kaveh R. Ghazi" Date: Thu, 15 Oct 2009 18:09:59 +0000 Subject: [PATCH] target-supports.exp (add_options_for_bind_pic_locally): New. * 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 | 5 +++++ gcc/testsuite/gcc.dg/tree-ssa/ipa-cp-1.c | 2 ++ gcc/testsuite/lib/target-supports.exp | 22 ++++++++++++++++++++++ 3 files changed, 29 insertions(+) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b54a6e0e3bc..4129a3e3aa0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-10-15 Kaveh R. Ghazi + + * 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 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 5f126363124..b9c67a62609 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 c287cec85bb..f8e83ec0988 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 { } { -- 2.30.2