+2010-03-05 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ Backport:
+ 2009-10-15 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+ * lib/target-supports.exp (add_options_for_bind_pic_locally): New.
+
+ 2009-10-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+ * g++.dg/other/first-global.C: Use dg-add-options bind_pic_locally.
+ * g++.dg/parse/attr-externally-visible-1.C: Likewise.
+ * g++.dg/tree-ssa/nothrow-1.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.
+
2010-02-16 Paolo Bonzini <bonzini@gnu.org>
* gcc.c-torture/execute/pr41917.c: New test.
/* { dg-do compile } */
-/* { dg-options "-fpie" { target { ! nonpic } } } */
+/* { dg-add-options bind_pic_locally } */
/* { dg-final { scan-assembler "_GLOBAL__I(_|_65535_0_)foobar" } } */
struct foo { foo (); };
// { dg-do compile }
// { dg-options "-O3 -fwhole-program" }
-// { dg-options "-O3 -fwhole-program -fpie" { target { ! nonpic } } }
+// { dg-add-options bind_pic_locally }
// { dg-final { scan-assembler "foo1" } }
// { dg-final { scan-assembler "foo2" } }
// { dg-final { scan-assembler "foo3" } }
/* { dg-do compile } */
/* { dg-options "-O1 -fdump-tree-cfg" } */
-/* { dg-skip-if "" { "*-*-*" } { "-fpic" "-fPIC" } { "" } } */
+/* { dg-add-options bind_pic_locally } */
+
double a;
void t()
{
/* { dg-do compile } */
/* { dg-options "-O3 -fipa-cp -fdump-ipa-cp -fno-early-inlining" } */
-/* { dg-skip-if "PR 25442" { "*-*-*" } { "-fpic" "-fPIC" } { "" } } */
+/* { dg-add-options bind_pic_locally } */
#include <stdio.h>
int g (int b, int c)
/* { dg-do compile } */
/* { dg-options "-O3 -fipa-cp -fdump-ipa-cp -fno-early-inlining" } */
-/* { dg-skip-if "PR 25442" { "*-*-*" } { "-fpic" "-fPIC" } { "" } } */
+/* { dg-add-options bind_pic_locally } */
#include <stdio.h>
int g (int b, int c)
/* { dg-do compile } */
/* { dg-options "-O3 -fipa-cp -fdump-ipa-cp -fno-early-inlining" } */
-/* { dg-skip-if "PR 25442" { "*-*-*" } { "-fpic" "-fPIC" } { "" } } */
+/* { dg-add-options bind_pic_locally } */
/* Double constants. */
/* { dg-do compile } */
/* { dg-options "-O3 -fipa-cp -fdump-ipa-cp" } */
-/* { dg-skip-if "PR 25442" { "*-*-*" } { "-fpic" "-fPIC" } { "" } } */
+/* { dg-add-options bind_pic_locally } */
#include <stdio.h>
int g (int b, int c)
/* { dg-do compile } */
/* { dg-options "-O3 -fipa-cp -fdump-ipa-cp -fno-early-inlining" } */
-/* { dg-skip-if "PR 25442" { "*-*-*" } { "-fpic" "-fPIC" } { "" } } */
+/* { dg-add-options bind_pic_locally } */
/* Float & short constants. */
/* { dg-do compile } */
/* { dg-options "-O3 -fipa-cp -fdump-ipa-cp -fno-early-inlining" } */
-/* { dg-skip-if "PR 25442" { "*-*-*" } { "-fpic" "-fPIC" } { "" } } */
+/* { dg-add-options bind_pic_locally } */
#include <stdio.h>
void send_addr (int *);
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 { } {