Description: Add dummy -arch option with simplistic check. Author: Heiko Przybyl 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 + /* 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) && 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->cputype, CPU_SUBTYPE_MULTIPLE); + if (gai) { + const char *name = gai->name; +#ifdef __LP64__ + /* Make sure x64 on 32bit kernel is set correctly. */ + if (gai->cputype == CPU_TYPE_I386) { + name = "x86_64"; + } + else if (gai->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