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] fix file type check for Darwin in gcc.misc-tests/linkage.exp


I noticed in my gcc testsuite results on x86_64-apple-darwin10
that for -m32 I was seeing...

FAIL: gcc.misc-tests/linkage.c link

Looking at gcc/testsuite/gcc.misc-tests/linkage.exp, I am baffled
why this hasn't failed more often. If I understand this code
correctly, linkage.exp is calling the system file command to
determine object file type. However under darwin9 and darwin10,
file gives for a 32-bit object file on intel...

Mach-O object i386

and for a 64-bit object file on intel...

Mach-O 64-bit object x86_64

while on powerpc darwin9 for a 32-bit object file we get...

Mach-O object ppc

and for a 64-bit object file we get...

Mach-O 64-bit object ppc64

I believe the patch below is the easiest fix for this problem.
Tested on x86_64-apple-darwin10 with...

make -k check-gcc RUNTESTFLAGS="linkage.exp=linkage.c --target_board=unix'{-m32,-m64}'"

Okay for gcc trunk?

2008-12-01  Jack Howarth  <howarth@bromo.med.uc.edu>

	* gcc/testsuite/gcc.misc-tests/linkage.exp: Correct file type check for Darwin.

Index: gcc/testsuite/gcc.misc-tests/linkage.exp
===================================================================
--- gcc/testsuite/gcc.misc-tests/linkage.exp	(revision 142335)
+++ gcc/testsuite/gcc.misc-tests/linkage.exp	(working copy)
@@ -73,14 +73,21 @@
 	    } elseif [ string match "*32-bit*" $file_string ] {
 		set native_cflags "-m32"
 	    }
-        } elseif [istarget "*-*-darwin*"] {
+        } elseif [istarget "powerpc*-*-darwin*"] {
             set file_string [exec file "linkage-x.o"]
-            if [ string match "*64-bit*" $file_string ] {
+            if [ string match "*ppc64" $file_string ] {
                 set native_cflags "-m64"
-            } elseif [ string match "*32-bit*" $file_string ] {
+            } elseif [ string match "*ppc" $file_string ] {
                 set native_cflags "-m32"
             }
-        }
+        } elseif [istarget "*86*-*-darwin*"] {
+	   set file_string [exec file "linkage-x.o"]
+	   if [ string match "*x86_64" $file_string ] {
+		set native_cflags "-m64"
+	   } elseif [ string match "*i386" $file_string ] {
+		set native_cflags "-m32"
+	   }
+	}
 
 	if [file exists "linkage-y.o"] then {
 	    file delete "linkage-y.o"


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