This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH TESTSUITE]: backport dg-add-options bind_pic_locally changes
- From: "Kaveh R. GHAZI" <ghazi at caip dot rutgers dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Cc: janis187 at us dot ibm dot com
- Date: Fri, 5 Mar 2010 11:18:54 -0500 (EST)
- Subject: [PATCH TESTSUITE]: backport dg-add-options bind_pic_locally changes
This patch backports the dg-add-options bind_pic_locally testsuite
changes. Tested on x86_64-unknown-linux-gnu on the 4.4 and 4.3 branches
via "make check" with extra -fpic/-fPIC passes.
Okay for backport to 4.4 and 4.3?
Thanks,
--Kaveh
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/ipa/iinline-1.C: Use dg-add-options bind_pic_locally.
* g++.dg/other/first-global.C: Likewise.
* g++.dg/parse/attr-externally-visible-1.C: Likewise.
* g++.dg/tree-ssa/nothrow-1.C: Likewise.
* gcc.dg/inline-33.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.
* gcc.dg/ipa/ipacost-2.c: Likewise.
2010-02-09 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* gcc.dg/tree-ssa/inline-4.c: Bind pic locally.
diff -rup orig/egcc-4.4-SVN20100305/gcc/testsuite/g++.dg/ipa/iinline-1.C egcc-4.4-SVN20100305/gcc/testsuite/g++.dg/ipa/iinline-1.C
--- orig/egcc-4.4-SVN20100305/gcc/testsuite/g++.dg/ipa/iinline-1.C 2009-03-27 22:47:40.000000000 +0100
+++ egcc-4.4-SVN20100305/gcc/testsuite/g++.dg/ipa/iinline-1.C 2010-03-05 04:03:47.000000000 +0100
@@ -2,7 +2,7 @@
inlining.. */
/* { dg-do compile } */
/* { dg-options "-O3 -fdump-ipa-inline -fno-early-inlining" } */
-/* { dg-options "-O3 -fdump-ipa-inline -fno-early-inlining -fpie" { target { ! nonpic } } } */
+/* { dg-add-options bind_pic_locally } */
extern void non_existent (const char *, int);
diff -rup orig/egcc-4.4-SVN20100305/gcc/testsuite/g++.dg/other/first-global.C egcc-4.4-SVN20100305/gcc/testsuite/g++.dg/other/first-global.C
--- orig/egcc-4.4-SVN20100305/gcc/testsuite/g++.dg/other/first-global.C 2009-03-27 22:47:31.000000000 +0100
+++ egcc-4.4-SVN20100305/gcc/testsuite/g++.dg/other/first-global.C 2010-03-05 04:03:47.000000000 +0100
@@ -1,5 +1,5 @@
/* { 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 (); };
diff -rup orig/egcc-4.4-SVN20100305/gcc/testsuite/g++.dg/parse/attr-externally-visible-1.C egcc-4.4-SVN20100305/gcc/testsuite/g++.dg/parse/attr-externally-visible-1.C
--- orig/egcc-4.4-SVN20100305/gcc/testsuite/g++.dg/parse/attr-externally-visible-1.C 2009-03-27 22:47:36.000000000 +0100
+++ egcc-4.4-SVN20100305/gcc/testsuite/g++.dg/parse/attr-externally-visible-1.C 2010-03-05 04:03:47.000000000 +0100
@@ -1,6 +1,6 @@
// { 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" } }
diff -rup orig/egcc-4.4-SVN20100305/gcc/testsuite/g++.dg/tree-ssa/nothrow-1.C egcc-4.4-SVN20100305/gcc/testsuite/g++.dg/tree-ssa/nothrow-1.C
--- orig/egcc-4.4-SVN20100305/gcc/testsuite/g++.dg/tree-ssa/nothrow-1.C 2009-03-27 22:47:32.000000000 +0100
+++ egcc-4.4-SVN20100305/gcc/testsuite/g++.dg/tree-ssa/nothrow-1.C 2010-03-05 04:03:50.000000000 +0100
@@ -1,6 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-O1 -fdump-tree-cfg" } */
-/* { dg-skip-if "" { "*-*-*" } { "-fpic" "-fPIC" } { "" } } */
+/* { dg-add-options bind_pic_locally } */
+
double a;
void t()
{
diff -rup orig/egcc-4.4-SVN20100305/gcc/testsuite/gcc.dg/inline-33.c egcc-4.4-SVN20100305/gcc/testsuite/gcc.dg/inline-33.c
--- orig/egcc-4.4-SVN20100305/gcc/testsuite/gcc.dg/inline-33.c 2009-03-27 22:47:20.000000000 +0100
+++ egcc-4.4-SVN20100305/gcc/testsuite/gcc.dg/inline-33.c 2010-03-05 04:03:50.000000000 +0100
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O3 -fdump-tree-optimized" } */
-/* { dg-options "-O3 -fdump-tree-optimized -fpie" { target { ! nonpic } } } */
+/* { dg-add-options bind_pic_locally } */
int i;
diff -rup orig/egcc-4.4-SVN20100305/gcc/testsuite/gcc.dg/ipa/ipa-1.c egcc-4.4-SVN20100305/gcc/testsuite/gcc.dg/ipa/ipa-1.c
--- orig/egcc-4.4-SVN20100305/gcc/testsuite/gcc.dg/ipa/ipa-1.c 2009-03-27 22:47:07.000000000 +0100
+++ egcc-4.4-SVN20100305/gcc/testsuite/gcc.dg/ipa/ipa-1.c 2010-03-05 04:03:50.000000000 +0100
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O3 -fipa-cp -fipa-cp-clone -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)
diff -rup orig/egcc-4.4-SVN20100305/gcc/testsuite/gcc.dg/ipa/ipa-2.c egcc-4.4-SVN20100305/gcc/testsuite/gcc.dg/ipa/ipa-2.c
--- orig/egcc-4.4-SVN20100305/gcc/testsuite/gcc.dg/ipa/ipa-2.c 2009-03-27 22:47:07.000000000 +0100
+++ egcc-4.4-SVN20100305/gcc/testsuite/gcc.dg/ipa/ipa-2.c 2010-03-05 04:03:50.000000000 +0100
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O3 -fipa-cp -fipa-cp-clone -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)
diff -rup orig/egcc-4.4-SVN20100305/gcc/testsuite/gcc.dg/ipa/ipa-3.c egcc-4.4-SVN20100305/gcc/testsuite/gcc.dg/ipa/ipa-3.c
--- orig/egcc-4.4-SVN20100305/gcc/testsuite/gcc.dg/ipa/ipa-3.c 2009-03-27 22:47:07.000000000 +0100
+++ egcc-4.4-SVN20100305/gcc/testsuite/gcc.dg/ipa/ipa-3.c 2010-03-05 04:03:50.000000000 +0100
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining" } */
-/* { dg-skip-if "PR 25442" { "*-*-*" } { "-fpic" "-fPIC" } { "" } } */
+/* { dg-add-options bind_pic_locally } */
/* Double constants. */
diff -rup orig/egcc-4.4-SVN20100305/gcc/testsuite/gcc.dg/ipa/ipa-4.c egcc-4.4-SVN20100305/gcc/testsuite/gcc.dg/ipa/ipa-4.c
--- orig/egcc-4.4-SVN20100305/gcc/testsuite/gcc.dg/ipa/ipa-4.c 2009-03-27 22:47:07.000000000 +0100
+++ egcc-4.4-SVN20100305/gcc/testsuite/gcc.dg/ipa/ipa-4.c 2010-03-05 04:04:57.000000000 +0100
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O3 -fipa-cp -fipa-cp-clone -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)
diff -rup orig/egcc-4.4-SVN20100305/gcc/testsuite/gcc.dg/ipa/ipa-5.c egcc-4.4-SVN20100305/gcc/testsuite/gcc.dg/ipa/ipa-5.c
--- orig/egcc-4.4-SVN20100305/gcc/testsuite/gcc.dg/ipa/ipa-5.c 2009-03-27 22:47:07.000000000 +0100
+++ egcc-4.4-SVN20100305/gcc/testsuite/gcc.dg/ipa/ipa-5.c 2010-03-05 04:03:50.000000000 +0100
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining" } */
-/* { dg-skip-if "PR 25442" { "*-*-*" } { "-fpic" "-fPIC" } { "" } } */
+/* { dg-add-options bind_pic_locally } */
/* Float & short constants. */
diff -rup orig/egcc-4.4-SVN20100305/gcc/testsuite/gcc.dg/ipa/ipa-7.c egcc-4.4-SVN20100305/gcc/testsuite/gcc.dg/ipa/ipa-7.c
--- orig/egcc-4.4-SVN20100305/gcc/testsuite/gcc.dg/ipa/ipa-7.c 2009-03-27 22:47:07.000000000 +0100
+++ egcc-4.4-SVN20100305/gcc/testsuite/gcc.dg/ipa/ipa-7.c 2010-03-05 04:03:50.000000000 +0100
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O3 -fipa-cp -fipa-cp-clone -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 *);
diff -rup orig/egcc-4.4-SVN20100305/gcc/testsuite/gcc.dg/ipa/ipacost-2.c egcc-4.4-SVN20100305/gcc/testsuite/gcc.dg/ipa/ipacost-2.c
--- orig/egcc-4.4-SVN20100305/gcc/testsuite/gcc.dg/ipa/ipacost-2.c 2009-03-27 22:47:07.000000000 +0100
+++ egcc-4.4-SVN20100305/gcc/testsuite/gcc.dg/ipa/ipacost-2.c 2010-03-05 04:03:50.000000000 +0100
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining -fdump-tree-optimized" } */
-/* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining -fdump-tree-optimized -fpie" { target { ! nonpic } } } */
+/* { dg-add-options bind_pic_locally } */
int array[100];
diff -rup orig/egcc-4.4-SVN20100305/gcc/testsuite/gcc.dg/tree-ssa/inline-4.c egcc-4.4-SVN20100305/gcc/testsuite/gcc.dg/tree-ssa/inline-4.c
--- orig/egcc-4.4-SVN20100305/gcc/testsuite/gcc.dg/tree-ssa/inline-4.c 2010-02-27 02:06:20.000000000 +0100
+++ egcc-4.4-SVN20100305/gcc/testsuite/gcc.dg/tree-ssa/inline-4.c 2010-03-05 04:09:13.000000000 +0100
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-einline2" } */
-/* { dg-options "-O2 -fdump-tree-einline2 -fpie" { target { ! nonpic } } } */
+/* { dg-add-options bind_pic_locally } */
extern int rand(void);
diff -rup orig/egcc-4.4-SVN20100305/gcc/testsuite/lib/target-supports.exp egcc-4.4-SVN20100305/gcc/testsuite/lib/target-supports.exp
--- orig/egcc-4.4-SVN20100305/gcc/testsuite/lib/target-supports.exp 2009-11-04 02:05:08.000000000 +0100
+++ egcc-4.4-SVN20100305/gcc/testsuite/lib/target-supports.exp 2010-03-05 04:02:33.000000000 +0100
@@ -2787,6 +2787,28 @@ proc add_options_for_c99_runtime { 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 { } {