This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] multilibs: handle -mno-* better
- From: DJ Delorie <dj at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 23 Jul 2003 20:33:56 -0400
- Subject: [patch] multilibs: handle -mno-* better
This handles cases like:
gcc -mthumb -mno-thumb foo.c
It doesn't have a generic way of letting the target note which
switches override which other switches, but for the particular target
I need this for, that's not a problem.
Tested by building --target=arm-elf and running "./xgcc
--print-multi-directory" with (and without) various options.
2003-07-23 DJ Delorie <dj@redhat.com>
* gcc.c (used_arg): Check if future options override the current
option when computing multilibs.
Index: gcc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcc.c,v
retrieving revision 1.389
diff -p -2 -r1.389 gcc.c
*** gcc.c 22 Jul 2003 23:15:27 -0000 1.389
--- gcc.c 24 Jul 2003 00:32:19 -0000
*************** used_arg (const char *p, int len)
*** 6772,6775 ****
--- 6772,6795 ----
{
int xlen = strlen (switches[i].part1);
+ /* Check to see if a future "-mno-foo" overrides this
+ "-mfoo", or visa versa, and for -f options too. */
+ if (switches[i].part1[0] == 'm'
+ || switches[i].part1[0] == 'f')
+ {
+ char *cmp = alloca (xlen + 4);
+ cmp[0] = switches[i].part1[0];
+ if (strncmp (switches[i].part1+1, "no-", 3) == 0)
+ strcpy (cmp+1, switches[i].part1+4);
+ else
+ {
+ strcpy (cmp+1, "no-");
+ strcpy (cmp+4, switches[i].part1+1);
+ }
+ for (j = i+1; j < n_switches; j++)
+ if (strcmp (switches[j].part1, cmp) == 0)
+ break;
+ }
+ if (j < n_switches)
+ continue;
for (j = 0; j < cnt; j++)
if (xlen == matches[j].len