This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug driver/48260] New: Accept -arch as an alias for -m32/-m64 on darwin
- From: "gcchelp.5.adept at 0sg dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Mar 2011 21:02:22 -0000
- Subject: [Bug driver/48260] New: Accept -arch as an alias for -m32/-m64 on darwin
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48260
Summary: Accept -arch as an alias for -m32/-m64 on darwin
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: driver
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: gcchelp.5.adept@0sg.net
If the GCC driver is supplied with '-arch i386' when invoked as linker on
intel-darwin, this should have the same effect as '-m32' (effectively an
alias). Conversely, if '-arch x86_64' is supplied, it should have the same
effect as '-m64'. No further support for the '-arch' switch is necessary.
Without this support, it is impossible to configure the latest GCC to be used
from within xcode. As a proof of concept, I have a patch working that achieves
this.
diff --recursive --normal -w gcc-4.6.0-RC-20110314/gcc/c-family/c.opt
gcc-4.6.0-RC-20110314-patched/gcc/c-family/c.opt
204c204
< C ObjC C++ ObjC++ Joined Separate MissingArgError(missing path after %qs)
---
> Driver C ObjC C++ ObjC++ Joined Separate MissingArgError(missing path after %qs)
diff --recursive --normal -w gcc-4.6.0-RC-20110314/gcc/config/darwin.opt
gcc-4.6.0-RC-20110314-patched/gcc/config/darwin.opt
33a34,36
> arch
> Driver RejectNegative Separate
>
diff --recursive --normal -w gcc-4.6.0-RC-20110314/gcc/config/i386/darwin.h
gcc-4.6.0-RC-20110314-patched/gcc/config/i386/darwin.h
120c120
< #define DARWIN_ARCH_SPEC "%{m64:x86_64;:i386}"
---
> #define DARWIN_ARCH_SPEC "%{m64:x86_64;arch*:%*;:i386}"
diff --recursive --normal -w gcc-4.6.0-RC-20110314/gcc/config/i386/darwin64.h
gcc-4.6.0-RC-20110314-patched/gcc/config/i386/darwin64.h
25c25
< #define DARWIN_ARCH_SPEC "%{m32:i386;:x86_64}"
---
> #define DARWIN_ARCH_SPEC "%{m32:i386;arch*:%*;:x86_64}"
diff --recursive --normal -w gcc-4.6.0-RC-20110314/gcc/config/i386/t-darwin
gcc-4.6.0-RC-20110314-patched/gcc/config/i386/t-darwin
2a3
> MULTILIB_MATCHES = "m64=arch+x86_64"
diff --recursive --normal -w gcc-4.6.0-RC-20110314/gcc/config/i386/t-darwin64
gcc-4.6.0-RC-20110314-patched/gcc/config/i386/t-darwin64
5a6
> MULTILIB_MATCHES = "m32=arch+i386"
diff --recursive --normal -w gcc-4.6.0-RC-20110314/gcc/gcc.c
gcc-4.6.0-RC-20110314-patched/gcc/gcc.c
7106a7107
> const char *arg;
7108a7110
> int arg_len;
7135c7137
< while (*q != ' ')
---
> while (*q != ' ' && *q != '+')
7146a7149,7162
> if (*q == '+')
> {
> matches[i].arg = ++q;
> while (*q != ' ')
> {
> if (*q == '\0')
> goto invalid_matches;
> q++;
> }
> matches[i].arg_len = q - matches[i].arg;
> }
> else
> matches[i].arg_len = 0;
>
7172c7188,7189
< && ! strncmp (switches[i].part1, matches[j].str, xlen))
---
> && ! strncmp (switches[i].part1, matches[j].str, xlen)
> && ( !matches[j].arg_len || ( switches[i].args && !strncmp (switches[i].args[0], matches[j].arg, matches[j].arg_len ) ) ) )