This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH TESTSUITE]: Favor "nonpic" effective target test over explicit -fpic/-fPIC checks


This patch eliminates checks for explicit uses of -fpic/-fPIC in favor of
the "nonpic" effective target test.  In the case of 20000804-1.c, the
generic x86 and darwin cases fold into one skip.  In the case of
clobbers.c, instead of skipping the entire test I only elide the
problematic code as is done for darwin.

Tested on x86_64-unknown-linux-gnu via "make check" on mainline and
branches with regular/-fpic/-fPIC passes in both 32 and 64 bit modes.

Okay everywhere?

		Thanks,
		--Kaveh


2010-03-09  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* g++.old-deja/g++.pt/asm1.C: Don't detect pic via looking for the
	-fpic/-fPIC flags.
	* g++.old-deja/g++.pt/asm2.C: Likewise.
	* gcc.c-torture/compile/20000804-1.c: Likewise.
	* gcc.target/i386/clobbers.c: Likewise.

diff -rup orig/egcc-SVN20100309/gcc/testsuite/g++.old-deja/g++.pt/asm1.C egcc-SVN20100309/gcc/testsuite/g++.old-deja/g++.pt/asm1.C
--- orig/egcc-SVN20100309/gcc/testsuite/g++.old-deja/g++.pt/asm1.C	2008-03-14 00:36:12.000000000 +0100
+++ egcc-SVN20100309/gcc/testsuite/g++.old-deja/g++.pt/asm1.C	2010-03-09 19:26:45.000000000 +0100
@@ -1,6 +1,6 @@
 // { dg-do assemble { target i?86-*-linux* x86_64-*-linux* } }
-// We'd use ebx with -fpic/-fPIC, so skip.
-// { dg-skip-if "" { ilp32 } { "-fpic" "-fPIC" } { "" } }
+// We'd use ebx with 32-bit pic code, so skip.
+// { dg-skip-if "" { ilp32 && { ! nonpic } } { "*" } { "" } }
 // Origin: "Weidmann, Nicholas" <nicholas.weidmann@swx.ch>

 template<int i> int foo(int v)
diff -rup orig/egcc-SVN20100309/gcc/testsuite/g++.old-deja/g++.pt/asm2.C egcc-SVN20100309/gcc/testsuite/g++.old-deja/g++.pt/asm2.C
--- orig/egcc-SVN20100309/gcc/testsuite/g++.old-deja/g++.pt/asm2.C	2008-03-14 00:36:10.000000000 +0100
+++ egcc-SVN20100309/gcc/testsuite/g++.old-deja/g++.pt/asm2.C	2010-03-09 19:27:05.000000000 +0100
@@ -1,7 +1,7 @@
 // { dg-do assemble { target i?86-*-linux* x86_64-*-linux* } }
 // { dg-require-effective-target ilp32 }
-// We'd use ebx with -fpic/-fPIC, so skip.
-// { dg-skip-if "" { *-*-* } { "-fpic" "-fPIC" } { "" } }
+// We'd use ebx with 32-bit pic code, so require nonpic.
+// { dg-require-effective-target nonpic }
 // Origin: "Weidmann, Nicholas" <nicholas.weidmann@swx.ch>

 typedef void (function_ptr)(int);
diff -rup orig/egcc-SVN20100309/gcc/testsuite/gcc.c-torture/compile/20000804-1.c egcc-SVN20100309/gcc/testsuite/gcc.c-torture/compile/20000804-1.c
--- orig/egcc-SVN20100309/gcc/testsuite/gcc.c-torture/compile/20000804-1.c	2009-07-15 02:02:35.000000000 +0200
+++ egcc-SVN20100309/gcc/testsuite/gcc.c-torture/compile/20000804-1.c	2010-03-09 19:21:48.000000000 +0100
@@ -1,8 +1,7 @@
 /* This does not work on m68hc11 or h8300 due to the use of an asm
    statement to force a 'long long' (64-bits) to go in a register.  */
 /* { dg-do assemble } */
-/* { dg-skip-if "" { { i?86-*-* x86_64-*-* } && ilp32 } { "-fpic" "-fPIC" } { "" } } */
-/* { dg-skip-if "PIC default" { { i?86-*-darwin*  x86_64-*-darwin* } && ilp32 } { "*" } { "" } } */
+/* { dg-skip-if "" { { i?86-*-* x86_64-*-* } && { ilp32 && { ! nonpic } } } { "*" } { "" } } */
 /* { dg-skip-if "No 64-bit registers" { m32c-*-* } { "*" } { "" } } */
 /* { dg-xfail-if "" { m6811-*-* m6812-*-* h8300-*-* } { "*" } { "" } } */

diff -rup orig/egcc-SVN20100309/gcc/testsuite/gcc.target/i386/clobbers.c egcc-SVN20100309/gcc/testsuite/gcc.target/i386/clobbers.c
--- orig/egcc-SVN20100309/gcc/testsuite/gcc.target/i386/clobbers.c	2008-03-14 00:37:27.000000000 +0100
+++ egcc-SVN20100309/gcc/testsuite/gcc.target/i386/clobbers.c	2010-03-09 19:29:29.000000000 +0100
@@ -1,7 +1,6 @@
 /* Test asm clobbers on x86. */

 /* { dg-do run } */
-/* { dg-skip-if "" { ilp32 } { "-fpic" "-fPIC" } { "" } } */

 extern void abort (void);

@@ -13,11 +12,15 @@ int main ()
                 abort ();
 	/* On darwin you can't call external functions from non-pic code,
 	   however, clobbering ebx isn't valid in pic code. Instead of
-	   disabling the whole test, just disable the ebx clobbering part.  */
+	   disabling the whole test, just disable the ebx clobbering part.
+	   Ditto for any x86 system that is ilp32 && pic.
+	*/
 #if !(defined (__MACH__))
+#if ! defined (__PIC__) || defined (__LP64__)
         __asm__ ("movl $1,%0\n\txorl %%ebx,%%ebx" : "=r" (i) : : "ebx");
         if (i != 1)
                 abort ();
+#endif /* ! pic || lp64 */
 #endif
         __asm__ ("movl $1,%0\n\txorl %%ecx,%%ecx" : "=r" (i) : : "ecx");
         if (i != 1)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]