aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2005-02-18 02:38:58 +0000
committerDevang Patel <dpatel@apple.com>2005-02-18 02:38:58 +0000
commit494ec5110264e155279d337b30848952dc39f17f (patch)
tree3386d3b1da4edb6aad8848be08a7a8926350ce20 /gcc
parent71ffce26beeeb4a61a2193eae16bef5be14c4709 (diff)
Undo Radar 3964387 fix.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/apple-ppc-branch@95214 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog.apple-ppc4
-rw-r--r--gcc/config/darwin-driver-i386.c35
-rw-r--r--gcc/config/darwin-driver-rs6000.c39
-rw-r--r--gcc/config/darwin-driver.c253
-rw-r--r--gcc/config/darwin-driver.h44
5 files changed, 51 insertions, 324 deletions
diff --git a/gcc/ChangeLog.apple-ppc b/gcc/ChangeLog.apple-ppc
index a14b846d59a..adfaa2d6a3c 100644
--- a/gcc/ChangeLog.apple-ppc
+++ b/gcc/ChangeLog.apple-ppc
@@ -1,3 +1,7 @@
+2005-02-17 Devang Patel <dpatel@apple.com>
+
+ Undo Radar 3964387 fix.
+
2005-02-17 Fariborz Jahanian <fjahanian@apple.com>
Radar 3971074
diff --git a/gcc/config/darwin-driver-i386.c b/gcc/config/darwin-driver-i386.c
deleted file mode 100644
index 2deb99fb300..00000000000
--- a/gcc/config/darwin-driver-i386.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* APPLE LOCAL file darwin driver support. */
-/* Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 2, or (at your option) any later
-version.
-
-GCC is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING. If not, write to the Free
-Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA. */
-
-#include <stddef.h>
-
-/* hack! */
-typedef int rtx;
-#define N_(msg) msg
-#define GTY(X)
-#include "config/i386/i386.h"
-#define GTY(X)
-#include "config/i386/darwin.h"
-
-#include "darwin-driver.h"
-
-target_switches i386_target_switches[] = TARGET_SWITCHES;
-
-
diff --git a/gcc/config/darwin-driver-rs6000.c b/gcc/config/darwin-driver-rs6000.c
deleted file mode 100644
index b89a25ac7d2..00000000000
--- a/gcc/config/darwin-driver-rs6000.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* APPLE LOCAL file darwin driver support. */
-/* Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 2, or (at your option) any later
-version.
-
-GCC is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING. If not, write to the Free
-Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA. */
-
-
-#include <stddef.h>
-
-/* hack! */
-typedef int rtx;
-#define N_(msg) msg
-#define GTY(X)
-#include "config/rs6000/rs6000.h"
-#define GTY(X)
-#include "config/rs6000/darwin.h"
-
-#include "darwin-driver.h"
-
-
-target_switches rs6000_target_switches[] = TARGET_SWITCHES;
-
-
-
-
diff --git a/gcc/config/darwin-driver.c b/gcc/config/darwin-driver.c
index 11706b66521..b0209988d46 100644
--- a/gcc/config/darwin-driver.c
+++ b/gcc/config/darwin-driver.c
@@ -48,20 +48,6 @@ typedef int tree;
#include "gcc.h"
-#include "darwin-driver.h"
-
-extern target_switches i386_target_switches[];
-
-extern target_switches rs6000_target_switches[];
-
-char **ppc_specific_args;
-int ppc_specific_args_size;
-int ppc_specific_arg_count = 0;
-
-char **x86_specific_args;
-int x86_specific_args_size;
-int x86_specific_arg_count = 0;
-
/* This program name. */
const char *progname;
@@ -175,104 +161,8 @@ static int do_compile (const char **, int);
static int do_compile_separately (void);
static int do_lipo_separately (void);
static int add_arch_options (int, const char **, int);
-static int remove_arch_options (const char**, int, int);
+static int remove_arch_options (const char**, int);
static void add_arch (const char *);
-static int is_ppc_specific_option (const char *);
-static int is_x86_specific_option (const char *);
-
-/* Return one if OPTION is a ppc specific option. Adds option into the list of ppc
- specific options. Return zero otherwise. */
-
-static int is_ppc_specific_option (const char *option)
-{
- int i = 0;
- int match = 0;
-
- /* OPTION must start with "-m" */
- if (!option && strlen (option) < 3)
- return 0;
-
- for (i=0;
- rs6000_target_switches[i].name && strcmp (rs6000_target_switches[i].name, "");
- i++)
- {
- /* Skip "-m" at the beginning of option string. */
- if (!strcmp (option+2, rs6000_target_switches[i].name))
- {
- match = 1;
- break;
- }
- }
- if (match)
- {
- int i;
- char *new_option = malloc (strlen (option)+1);
- strcpy(new_option, option);
-
-#ifdef DEBUG
- fprintf (stderr, "PPC specific new option : %s\n", new_option);
-#endif
-
- if (ppc_specific_arg_count == ppc_specific_args_size)
- {
- /* expand array */
- ppc_specific_args_size = ppc_specific_arg_count + 10;
- ppc_specific_args = (char**) realloc (ppc_specific_args, ppc_specific_args_size);
- }
-
- ppc_specific_args[ppc_specific_arg_count] = new_option;
- ppc_specific_arg_count++;
- }
-
- return match;
-}
-
-/* Return one if OPTION is a x86 specific. Adds option into the list of x86
- specific options. Return zero otherwise. */
-
-static int is_x86_specific_option (const char *option)
-{
- int i = 0;
- int match = 0;
-
- /* OPTION must start with "-m" */
- if (!option && strlen (option) < 3)
- return 0;
-
- for (i = 0;
- i386_target_switches[i].name && strcmp(i386_target_switches[i].name, "");
- i++)
- {
- /* Skip "-m" at the beginning of option. */
- if (!strcmp (option+2, i386_target_switches[i].name))
- {
- match = 1;
- break;
- }
- }
- if (match)
- {
- int i;
- char *new_option = malloc (strlen (option)+1);
- strcpy(new_option, option);
-
-#ifdef DEBUG
- fprintf (stderr, "X86 specific new option : %s\n", new_option);
-#endif
-
- if (x86_specific_arg_count == x86_specific_args_size)
- {
- /* expand array */
- x86_specific_args_size = x86_specific_arg_count + 10;
- x86_specific_args = (char**) realloc (x86_specific_args, x86_specific_args_size);
- }
-
- x86_specific_args[x86_specific_arg_count] = new_option;
- x86_specific_arg_count++;
- }
-
- return match;
-}
/* Find arch name for the given input string. If input name is NULL then local
arch name is used. */
@@ -418,7 +308,6 @@ debug_command_line (const char **debug_argv, int debug_argc)
for (i = 0; debug_argv[i]; i++)
fprintf (stderr,"%s: arg [%d] %s\n", progname, i, debug_argv[i]);
- fprintf (stderr, "------\n");
}
#endif
@@ -661,7 +550,7 @@ do_compile (const char **current_argv, int current_argc)
/* Remove the last arch option added in the current_argv list. */
if (additional_arch_options)
- argc_count -= remove_arch_options (current_argv, argc_count, additional_arch_options);
+ argc_count -= remove_arch_options (current_argv, argc_count);
index++;
}
@@ -753,107 +642,70 @@ do_lipo_separately (void)
static int
add_arch_options (int index, const char **current_argv, int arch_index)
{
-
- int count = 0;
- int add_ppc_options = 0;
- int add_x86_options = 0;
+
+ int count;
/* We are adding 1 argument for selected arches. */
count = 1;
#ifdef DEBUG
- fprintf (stderr, "%s: add_arch_options: %s %d\n", progname, arches[index], arch_index);
+ fprintf (stderr, "%s: add_arch_options: %s\n", progname, arches[index]);
#endif
if (!strcmp (arches[index], "ppc601"))
- { current_argv[arch_index] = "-mcpu=601"; add_ppc_options = 1; }
+ current_argv[arch_index] = "-mcpu=601";
else if (!strcmp (arches[index], "ppc603"))
- { current_argv[arch_index] = "-mcpu=603"; add_ppc_options = 1; }
+ current_argv[arch_index] = "-mcpu=603";
else if (!strcmp (arches[index], "ppc604"))
- { current_argv[arch_index] = "-mcpu=604"; add_ppc_options = 1; }
+ current_argv[arch_index] = "-mcpu=604";
else if (!strcmp (arches[index], "ppc604e"))
- { current_argv[arch_index] = "-mcpu=604e"; add_ppc_options = 1; }
+ current_argv[arch_index] = "-mcpu=604e";
else if (!strcmp (arches[index], "ppc750"))
- { current_argv[arch_index] = "-mcpu=750"; add_ppc_options = 1; }
+ current_argv[arch_index] = "-mcpu=750";
else if (!strcmp (arches[index], "ppc7400"))
- { current_argv[arch_index] = "-mcpu=7400"; add_ppc_options = 1; }
+ current_argv[arch_index] = "-mcpu=7400";
else if (!strcmp (arches[index], "ppc7450"))
- { current_argv[arch_index] = "-mcpu=7450"; add_ppc_options = 1; }
+ current_argv[arch_index] = "-mcpu=7450";
else if (!strcmp (arches[index], "ppc970"))
- { current_argv[arch_index] = "-mcpu=970"; add_ppc_options = 1; }
+ current_argv[arch_index] = "-mcpu=970";
else if (!strcmp (arches[index], "ppc64"))
- { current_argv[arch_index] = "-m64"; add_ppc_options = 1; }
+ current_argv[arch_index] = "-m64";
else if (!strcmp (arches[index], "i386"))
- { current_argv[arch_index] = "-march=i386"; add_x86_options = 1; }
+ current_argv[arch_index] = "-march=i386";
else if (!strcmp (arches[index], "i486"))
- { current_argv[arch_index] = "-march=i486"; add_x86_options = 1; }
+ current_argv[arch_index] = "-march=i486";
else if (!strcmp (arches[index], "i586"))
- { current_argv[arch_index] = "-march=i586"; add_x86_options = 1; }
+ current_argv[arch_index] = "-march=i586";
else if (!strcmp (arches[index], "i686"))
- { current_argv[arch_index] = "-march=i686"; add_x86_options = 1; }
+ current_argv[arch_index] = "-march=i686";
else if (!strcmp (arches[index], "pentium"))
- { current_argv[arch_index] = "-march=pentium"; add_x86_options = 1; }
+ current_argv[arch_index] = "-march=pentium";
else if (!strcmp (arches[index], "pentpro"))
- { current_argv[arch_index] = "-march=pentiumpro"; add_x86_options = 1; }
+ current_argv[arch_index] = "-march=pentiumpro";
else if (!strcmp (arches[index], "pentIIm3"))
- { current_argv[arch_index] = "-march=pentium3"; add_x86_options = 1; }
+ current_argv[arch_index] = "-march=pentium3";
else
count = 0;
- if ((add_ppc_options && ppc_specific_arg_count)
- || !strcmp (arches[index], "ppc"))
- {
- int i;
- /* current_argv has enough space to include arch specific options. */
- for (i=0; i < ppc_specific_arg_count; i++)
- {
- current_argv[arch_index + i + count] = ppc_specific_args[i];
-#ifdef DEBUG
- printf ("adding ... %s\n", ppc_specific_args[i]);
-#endif
- }
- count += i;
- }
- else if (add_x86_options && x86_specific_arg_count)
- {
- int i;
- /* current_argv has enough space to include arch specific options. */
- for (i=0; i < x86_specific_arg_count; i++)
- {
- current_argv[arch_index + i + count] = x86_specific_args[i];
-#ifdef DEBUG
- printf ("adding ... %s\n", x86_specific_args[i]);
-#endif
- }
- count += i;
- }
-#ifdef DEBUG
- debug_command_line (current_argv, count);
-#endif
return count;
}
-/* Remove number of arch specific COUNT options. All arch specific options
- are at the and. ARCH_INDEX is an index for last option. Return count
- of options actaully removed. */
+/* Remove the last option, which is arch option, added by
+ add_arch_options. Return how count of arguments removed. */
static int
-remove_arch_options (const char **current_argv, int arch_index, int count)
+remove_arch_options (const char **current_argv, int arch_index)
{
- int i;
#ifdef DEBUG
- fprintf (stderr, "%s: Removing %d arguments beginning at %d\n",
- progname, count, arch_index-count);
- debug_command_line (current_argv, arch_index);
+ fprintf (stderr, "%s: Removing argument no %d\n", progname, arch_index);
#endif
- for (i=0; i<count; i++)
- current_argv[arch_index - count + i] = '\0';
+ current_argv[arch_index] = '\0';
#ifdef DEBUG
debug_command_line (current_argv, arch_index);
#endif
- return i;
+ return 1;
}
/* Add new arch request. */
@@ -1373,44 +1225,33 @@ main (int argc, const char **argv)
{
const char *p = &argv[i][1];
int c = *p;
- int skip = 0;
- /* Interpret target specific options that start with "-m". */
- if (argv[i][1] == 'm')
+ /* First copy this flag itself. */
+ new_argv[new_argc++] = argv[i];
+
+ /* Now copy this flag's arguments, if any, appropriately. */
+ if ((SWITCH_TAKES_ARG (c) > (p[1] != 0))
+ || WORD_SWITCH_TAKES_ARG (p))
{
+ int j = 0;
+ int n_args = WORD_SWITCH_TAKES_ARG (p);
+ if (n_args == 0)
+ {
+ /* Count only the option arguments in separate argv elements. */
+ n_args = SWITCH_TAKES_ARG (c) - (p[1] != 0);
+ }
+ if (i + n_args >= argc)
+ fatal ("argument to `-%s' is missing", p);
- skip = is_ppc_specific_option (&argv[i][0]);
- skip |= is_x86_specific_option (&argv[i][0]);
- }
- if (!skip)
- {
- /* First copy this flag itself. */
- new_argv[new_argc++] = argv[i];
-
- /* Now copy this flag's arguments, if any, appropriately. */
- if ((SWITCH_TAKES_ARG (c) > (p[1] != 0))
- || WORD_SWITCH_TAKES_ARG (p))
+ while ( j < n_args)
{
- int j = 0;
- int n_args = WORD_SWITCH_TAKES_ARG (p);
- if (n_args == 0)
- {
- /* Count only the option arguments in separate argv elements. */
- n_args = SWITCH_TAKES_ARG (c) - (p[1] != 0);
- }
- if (i + n_args >= argc)
- fatal ("argument to `-%s' is missing", p);
-
-
- while ( j < n_args)
- {
- i++;
- new_argv[new_argc++] = argv[i];
- j++;
- }
+ i++;
+ new_argv[new_argc++] = argv[i];
+ j++;
}
}
+
}
else
{
diff --git a/gcc/config/darwin-driver.h b/gcc/config/darwin-driver.h
deleted file mode 100644
index 50237c5f322..00000000000
--- a/gcc/config/darwin-driver.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* APPLE LOCAL file darwin driver support. */
-/* Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 2, or (at your option) any later
-version.
-
-GCC is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING. If not, write to the Free
-Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA. */
-
-#ifndef DARWIN_DRIVER_H
-#define DARWIN_DRIVER_H
-
-/* Plagarized from toplev.h. */
-
-typedef struct target_switches
-{
- const char *const name;
- const int value;
- const char *const description;
-} target_switches;
-
-/* This table is similar, but allows the switch to have a value. */
-
-typedef struct target_options
-{
- const char *const prefix;
- const char **const variable;
- const char *const description;
- const char *const value;
-} target_options;
-
-#endif
-