<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">Description:	Add dummy -arch option with simplistic check.
Author:			Heiko Przybyl &lt;zuxez@cs.tu-berlin.de&gt;

diff -pruN gcc-5664.orig/gcc/gcc.c gcc-5664/gcc/gcc.c
--- gcc-5664.orig/gcc/gcc.c	2010-09-21 22:28:11.000000000 +0200
+++ gcc-5664/gcc/gcc.c	2010-09-21 22:28:24.000000000 +0200
@@ -88,6 +88,8 @@ compilation is specified by a string cal
 #include "flags.h"
 #include "opts.h"
 
+#include &lt;mach-o/arch.h&gt;
+
 /* By default there is no special suffix for target executables.  */
 /* FIXME: when autoconf is fixed, remove the host check - dj */
 #if defined(TARGET_EXECUTABLE_SUFFIX) &amp;&amp; defined(HOST_EXECUTABLE_SUFFIX)
--- gcc-5664/gcc/gcc.c.orig	2010-09-22 01:30:04.000000000 +0200
+++ gcc-5664/gcc/gcc.c	2010-09-22 01:36:52.000000000 +0200
@@ -1401,6 +1401,39 @@ translate_options (int *argcp, const cha
 	    nskip += 1;
 	  else if (! strcmp (p, "Xassembler"))
 	    nskip += 1;
+	  /* GENTOO_PORTAGE Allow but filter -arch. */
+	  if (! strcmp (p, "arch")) {
+		if (i + 1 == argc)
+			fatal ("argument to `-arch' is missing");
+		/* Check current arch vs. given arch if possible. */
+		const NXArchInfo *ai = NXGetLocalArchInfo();
+		if (ai) {
+			/* Returns the most generic setting */
+			/* aka "i386", "x86_64", "ppc", "ppc64", "arm". */
+			const NXArchInfo *gai = NXGetArchInfoFromCpuType(ai-&gt;cputype, CPU_SUBTYPE_MULTIPLE);
+			if (gai) {
+				const char *name = gai-&gt;name;
+#ifdef __LP64__
+				/* Make sure x64 on 32bit kernel is set correctly. */
+				if (gai-&gt;cputype == CPU_TYPE_I386) {
+					name = "x86_64";
+				}
+				else if (gai-&gt;cputype == CPU_TYPE_POWERPC) {
+					name = "ppc64";
+				}                       
+#endif                              
+				if (strcmp(name, argv[i + 1]) != 0) {
+					fatal ("`-arch %s' does not match current compiler arch `%s'",
+						argv[i + 1], name);
+				}                       
+			}                           
+		}                               
+
+		/* Skip argument. */
+		i += 2;
+		/* Don't add option to the new env. */
+		nskip = 0;
+	  }
 
 	  /* Watch out for an option at the end of the command line that
 	     is missing arguments, and avoid skipping past the end of the
</pre></body></html>