Hallo list, please review the following patch (and besides, bear with me as this is the first patch proposal from me). For gcc 4.5 and earlier it was possible to configure xcode via a modified xcplugin to use the newer gcc directly (yes, the -arch flag was ignored during link time, but since I had -m32/-m64 anyways, this didn't matter). With the new argument checking of version 4.6 during the linking stage this is no longer possible. The proposed patch makes gcc on darwin recognize the -arch flag to the extent necessary to reinstate the old functionality. Besides, it fixes the already existing support for the -F flag.
Thanks, Christian 2011-03-28 Christian Schüler <cschueler <at> gmx.de> PR 48208 * config/c.opt: Added 'Driver' to -F option PR 48260 * config/darwin-driver.c: Add '-arch' to handler function * config/darwin.opt: Added '-arch' option diff -Naurw gcc-4.6.0-RC-20110321/gcc/c-family/c.opt \ gcc-4.6.0-RC-20110321-patched/gcc/c-family/c.opt --- gcc-4.6.0-RC-20110321/gcc/c-family/c.opt 2011-02-17 22:34:10 +0100 +++ gcc-4.6.0-RC-20110321-patched/gcc/c-family/c.opt 2011-03-25 19:04:08 +0100 @@ -201,7 +201,7 @@ C ObjC C++ ObjC++ Undocumented Var(flag_preprocess_only) F -C ObjC C++ ObjC++ Joined Separate MissingArgError(missing path after %qs) +Driver C ObjC C++ ObjC++ Joined Separate MissingArgError(missing path after \ %qs) -F <dir> Add <dir> to the end of the main framework include path H diff -Naurw gcc-4.6.0-RC-20110321/gcc/config/darwin-driver.c \ gcc-4.6.0-RC-20110321-patched/gcc/config/darwin-driver.c --- gcc-4.6.0-RC-20110321/gcc/config/darwin-driver.c 2010-11-11 00:23:15 +0100 +++ gcc-4.6.0-RC-20110321-patched/gcc/config/darwin-driver.c 2011-03-26 07:01:02.000000000 +0100 @@ -161,6 +161,13 @@ continue; switch ((*decoded_options)[i].opt_index) { +#if DARWIN_X86 + case OPT_arch: + if (!strcmp ((*decoded_options)[i].arg, "i386")) + generate_option (OPT_m32, NULL, 1, CL_DRIVER, &(*decoded_options)[i]); + else if (!strcmp ((*decoded_options)[i].arg, "x86_64")) + generate_option (OPT_m64, NULL, 1, CL_DRIVER, &(*decoded_options)[i]); + break; +#endif + case OPT_filelist: case OPT_framework: ++*decoded_options_count; diff -Naurw gcc-4.6.0-RC-20110321/gcc/config/darwin.opt \ gcc-4.6.0-RC-20110321-patched/gcc/config/darwin.opt --- gcc-4.6.0-RC-20110321/gcc/config/darwin.opt 2011-02-07 21:11:45 +0100 +++ gcc-4.6.0-RC-20110321-patched/gcc/config/darwin.opt 2011-03-25 19:04:08 +0100 @@ -31,6 +31,9 @@ allowable_client Driver Separate Alias(Zallowable_client) +arch +Driver RejectNegative Separate + arch_errors_fatal Driver Alias(Zarch_errors_fatal)