aboutsummaryrefslogtreecommitdiff
path: root/gcc/gcc.c
diff options
context:
space:
mode:
authorRainer Orth <ro@TechFak.Uni-Bielefeld.DE>2001-08-02 12:26:00 +0000
committerRainer Orth <ro@gcc.gnu.org>2001-08-02 12:26:00 +0000
commit578672a2676308528001f385e2f3773595ec3387 (patch)
tree9d31c155fc6533acc82d406f6aeb96eb7ad549f9 /gcc/gcc.c
parent1dbb6023c73cfb340b24d8c81cf31f41f8f1805b (diff)
downloadgcc-578672a2676308528001f385e2f3773595ec3387.zip
gcc-578672a2676308528001f385e2f3773595ec3387.tar.gz
gcc-578672a2676308528001f385e2f3773595ec3387.tar.bz2
re PR java/227 (mips-tfile:internal error (when compiling java code))
* gcc.c (set_collect_gcc_options): New function, split out from main. Ignore elided switches. (do_spec_1): Invoke before executing command. (set_input): Export. Move declaration ... * gcc.h (set_input): ... here. * config/alpha/osf.h (ASM_FINAL_SPEC): Use %U.s to refer to input file. java: * jvspec.c (jvgenmain_spec): Cannot use %umain, breaks ASM_FINAL_SPEC. (lang_specific_pre_link): Use set_input to set input_filename. Append `main' here. * jvgenmain.c (usage): Append literal `main' to CLASSNAME. (main): Fix definition. Strip `main' from classname. Fixes PR java/227. From-SVN: r44572
Diffstat (limited to 'gcc/gcc.c')
-rw-r--r--gcc/gcc.c109
1 files changed, 61 insertions, 48 deletions
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 409ac2b..ed86fa0 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -289,6 +289,7 @@ static void clear_failure_queue PARAMS ((void));
static int check_live_switch PARAMS ((int, int));
static const char *handle_braces PARAMS ((const char *));
static char *save_string PARAMS ((const char *, int));
+static void set_collect_gcc_options PARAMS ((void));
static int do_spec_1 PARAMS ((const char *, int, const char *));
static const char *find_file PARAMS ((const char *));
static int is_directory PARAMS ((const char *, const char *, int));
@@ -312,7 +313,6 @@ static void process_command PARAMS ((int, const char *const *));
static int execute PARAMS ((void));
static void clear_args PARAMS ((void));
static void fatal_error PARAMS ((int));
-static void set_input PARAMS ((const char *));
static void init_gcc_specs PARAMS ((struct obstack *,
const char *,
const char *));
@@ -3960,6 +3960,63 @@ process_command (argc, argv)
switches[n_switches].part1 = 0;
infiles[n_infiles].name = 0;
}
+
+/* Store switches not filtered out but %{<S} in spec in COLLECT_GCC_OPTIONS
+ and place that in the environment. */
+
+static void
+set_collect_gcc_options ()
+{
+ int i;
+ int first_time;
+
+ /* Build COLLECT_GCC_OPTIONS to have all of the options specified to
+ the compiler. */
+ obstack_grow (&collect_obstack, "COLLECT_GCC_OPTIONS=",
+ sizeof ("COLLECT_GCC_OPTIONS=") - 1);
+
+ first_time = TRUE;
+ for (i = 0; (int) i < n_switches; i++)
+ {
+ const char *const *args;
+ const char *p, *q;
+ if (!first_time)
+ obstack_grow (&collect_obstack, " ", 1);
+
+ first_time = FALSE;
+
+ /* Ignore elided switches. */
+ if (switches[i].live_cond == SWITCH_IGNORE)
+ continue;
+
+ obstack_grow (&collect_obstack, "'-", 2);
+ q = switches[i].part1;
+ while ((p = strchr (q, '\'')))
+ {
+ obstack_grow (&collect_obstack, q, p - q);
+ obstack_grow (&collect_obstack, "'\\''", 4);
+ q = ++p;
+ }
+ obstack_grow (&collect_obstack, q, strlen (q));
+ obstack_grow (&collect_obstack, "'", 1);
+
+ for (args = switches[i].args; args && *args; args++)
+ {
+ obstack_grow (&collect_obstack, " '", 2);
+ q = *args;
+ while ((p = strchr (q, '\'')))
+ {
+ obstack_grow (&collect_obstack, q, p - q);
+ obstack_grow (&collect_obstack, "'\\''", 4);
+ q = ++p;
+ }
+ obstack_grow (&collect_obstack, q, strlen (q));
+ obstack_grow (&collect_obstack, "'", 1);
+ }
+ }
+ obstack_grow (&collect_obstack, "\0", 1);
+ putenv (obstack_finish (&collect_obstack));
+}
/* Process a spec string, accumulating and running commands. */
@@ -4103,6 +4160,8 @@ do_spec_1 (spec, inswitch, soft_matched_part)
argbuf_index--;
}
+ set_collect_gcc_options ();
+
if (argbuf_index > 0)
{
value = execute ();
@@ -5486,7 +5545,7 @@ is_directory (path1, path2, linker)
/* Set up the various global variables to indicate that we're processing
the input file named FILENAME. */
-static void
+void
set_input (filename)
const char *filename;
{
@@ -5659,52 +5718,6 @@ main (argc, argv)
process_command (argc, argv);
- {
- int first_time;
-
- /* Build COLLECT_GCC_OPTIONS to have all of the options specified to
- the compiler. */
- obstack_grow (&collect_obstack, "COLLECT_GCC_OPTIONS=",
- sizeof ("COLLECT_GCC_OPTIONS=") - 1);
-
- first_time = TRUE;
- for (i = 0; (int) i < n_switches; i++)
- {
- const char *const *args;
- const char *p, *q;
- if (!first_time)
- obstack_grow (&collect_obstack, " ", 1);
-
- first_time = FALSE;
- obstack_grow (&collect_obstack, "'-", 2);
- q = switches[i].part1;
- while ((p = strchr (q, '\'')))
- {
- obstack_grow (&collect_obstack, q, p - q);
- obstack_grow (&collect_obstack, "'\\''", 4);
- q = ++p;
- }
- obstack_grow (&collect_obstack, q, strlen (q));
- obstack_grow (&collect_obstack, "'", 1);
-
- for (args = switches[i].args; args && *args; args++)
- {
- obstack_grow (&collect_obstack, " '", 2);
- q = *args;
- while ((p = strchr (q, '\'')))
- {
- obstack_grow (&collect_obstack, q, p - q);
- obstack_grow (&collect_obstack, "'\\''", 4);
- q = ++p;
- }
- obstack_grow (&collect_obstack, q, strlen (q));
- obstack_grow (&collect_obstack, "'", 1);
- }
- }
- obstack_grow (&collect_obstack, "\0", 1);
- putenv (obstack_finish (&collect_obstack));
- }
-
/* Initialize the vector of specs to just the default.
This means one element containing 0s, as a terminator. */