From: Christophe Lyon Date: Sat, 11 Oct 2014 11:33:37 +0000 (+0000) Subject: target-supports.exp (check_effective_target_shared): New function. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1665db4dbd2b04ed42f094b399db251bb2f8b839;p=gcc.git target-supports.exp (check_effective_target_shared): New function. 2014-10-11 Christophe Lyon gcc/testsuite/ * lib/target-supports.exp (check_effective_target_shared): New function. * g++.dg/ipa/devirt-28a.C: Check if -shared is supported. From-SVN: r216117 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e77c6a1ff32..b038c828d38 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2014-10-11 Christophe Lyon + + * lib/target-supports.exp (check_effective_target_shared): New + function. + * g++.dg/ipa/devirt-28a.C: Check if -shared is supported. + 2014-10-10 Jakub Jelinek PR c/63495 diff --git a/gcc/testsuite/g++.dg/ipa/devirt-28a.C b/gcc/testsuite/g++.dg/ipa/devirt-28a.C index bdd1682022a..65d5fcdf3e2 100644 --- a/gcc/testsuite/g++.dg/ipa/devirt-28a.C +++ b/gcc/testsuite/g++.dg/ipa/devirt-28a.C @@ -1,6 +1,6 @@ // PR c++/58678 // { dg-options "-O3 -flto -shared -fPIC -Wl,--no-undefined" } -// { dg-do link { target { gld && fpic } } } +// { dg-do link { target { { gld && fpic } && shared } } } struct A { virtual ~A(); diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 2144683f230..4398345eb8a 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -840,6 +840,19 @@ proc check_effective_target_fpic { } { return 0 } +# Return 1 if -shared is supported, as in no warnings or errors +# emitted, 0 otherwise. + +proc check_effective_target_shared { } { + # Note that M68K has a multilib that supports -fpic but not + # -fPIC, so we need to check both. We test with a program that + # requires GOT references. + return [check_no_compiler_messages shared executable { + extern int foo (void); extern int bar; + int baz (void) { return foo () + bar; } + } "-shared -fpic"] +} + # Return 1 if -pie, -fpie and -fPIE are supported, 0 otherwise. proc check_effective_target_pie { } {