GCJ Build Error

The Morsbergers morsberger@usa.net
Fri Aug 10 19:02:00 GMT 2001


Is someone going to keep the java / alpha patches until a generic fix is
found?

-- 
David Morsberger 

> From: Alexandre Petit-Bianco <apbianco@cygnus.com>
> Reply-To: apbianco@cygnus.com
> Date: Fri, 10 Aug 2001 17:34:35 -0700 (PDT)
> To: Antonio Ake <ake@ecn.purdue.edu>, The Morsbergers <morsberger@usa.net>,
> <java@gcc.gnu.org>
> Subject: Re: GCJ Build Error
> 
> 
> Antonio Ake writes:
> 
>> Ok. First I need to tell you this, In version 3.0, libgcj for True64
>> is not supported. There have been solved like 10 problems for True64
>> v5.0(mine version) for GCC 3.0, and finally there is a very
>> acceptable version.
> 
> OK, unfortunately, that patch will have to be reverted:
> 
> http://gcc.gnu.org/ml/gcc/2001-08/msg00569.html
> 
> It's not too obvious to me what makes it break things for some folks.
> 
> Mark Mitchell is pushing for this to happen. Rainer is unreachable
> until September 10. I don't really have the time to look into
> that. We'll have to revert the patch and re-open the PR java/227. I
> know, it's a bummer. Hopefully support will be restored in the trunk
> (the patch will be removed from the trunk too) as soon as someone has
> some usefull time to spend on it.
> 
> Note that this doesn't prevent anyone from keeping them changes
> locally and keep on hacking. The patch that will be reverted is the
> following.
> 
> ./A
> 
> 
> Index: gcc.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/gcc.c,v
> retrieving revision 1.205.2.18
> retrieving revision 1.205.2.19
> diff -u -p -r1.205.2.18 -r1.205.2.19
> --- gcc.c 2001/06/10 00:30:43 1.205.2.18
> +++ gcc.c 2001/08/02 12:22:49 1.205.2.19
> @@ -243,6 +243,7 @@ static void clear_failure_queue PARAMS (
> 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));
> @@ -266,7 +267,6 @@ static void process_command  PARAMS ((in
> 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 *));
> @@ -3869,6 +3869,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.  */
> 
> @@ -4012,6 +4069,8 @@ do_spec_1 (spec, inswitch, soft_matched_
> argbuf_index--;
> }
> 
> + set_collect_gcc_options ();
> +
> if (argbuf_index > 0)
> {
> value = execute ();
> @@ -5395,7 +5454,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;
> {
> @@ -5567,52 +5626,6 @@ main (argc, argv)
> Decode switches that are handled locally.  */
> 
> 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.  */
> Index: gcc.h
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/gcc.h,v
> retrieving revision 1.3.6.2
> retrieving revision 1.3.6.3
> diff -u -p -r1.3.6.2 -r1.3.6.3
> --- gcc.h 2001/05/18 18:40:50 1.3.6.2
> +++ gcc.h 2001/08/02 12:22:50 1.3.6.3
> @@ -1,5 +1,5 @@
> /* Header file for modules that link with gcc.c
> -   Copyright (C) 1999 Free Software Foundation, Inc.
> +   Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
> 
> This file is part of GNU CC.
> 
> @@ -33,6 +33,7 @@ extern void fatal PARAMS ((const char *,
> ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
> extern void error PARAMS ((const char *, ...)) ATTRIBUTE_PRINTF_1;
> extern void pfatal_with_name PARAMS ((const char *)) ATTRIBUTE_NORETURN;
> +extern void set_input PARAMS ((const char *));
> 
> /* Spec files linked with gcc.c must provide definitions for these. */
> 
> Index: java/jvgenmain.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/java/jvgenmain.c,v
> retrieving revision 1.23.2.1
> retrieving revision 1.23.2.2
> diff -u -p -r1.23.2.1 -r1.23.2.2
> --- jvgenmain.c 2001/07/04 12:04:06 1.23.2.1
> +++ jvgenmain.c 2001/08/02 12:22:54 1.23.2.2
> @@ -62,14 +62,14 @@ static void usage (const char *) ATTRIBU
> static void
> usage (const char *name)
> {
> -  fprintf (stderr, "Usage: %s [OPTIONS]... CLASSNAME [OUTFILE]\n", name);
> +  fprintf (stderr, "Usage: %s [OPTIONS]... CLASSNAMEmain [OUTFILE]\n", name);
> exit (1);
> }
> 
> int
> -main (int argc, const char **argv)
> +main (int argc, char **argv)
> {
> -  const char *classname;
> +  char *classname, *p;
> FILE *stream;
> const char *mangled_classname;
> int i, last_arg;
> @@ -92,6 +92,13 @@ main (int argc, const char **argv)
> last_arg = i;
> 
> classname = argv[i];
> +
> +  /* gcj always appends `main' to classname.  We need to strip this here.  */
> +  p = strrchr (classname, 'm');
> +  if (p == NULL || p == classname || strcmp (p, "main") != 0)
> +    usage (argv[0]);
> +  else
> +    *p = '\0';
> 
> gcc_obstack_init (mangle_obstack);
> mangled_classname = do_mangle_classname (classname);
> Index: java/jvspec.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/java/jvspec.c,v
> retrieving revision 1.35.2.6
> retrieving revision 1.35.2.7
> diff -u -p -r1.35.2.6 -r1.35.2.7
> --- jvspec.c 2001/07/13 23:12:35 1.35.2.6
> +++ jvspec.c 2001/08/02 12:22:54 1.35.2.7
> @@ -52,8 +52,8 @@ int lang_specific_extra_outfiles = 0;
> int shared_libgcc = 1;
> 
> const char jvgenmain_spec[] =
> -  "jvgenmain %{D*} %i %{!pipe:%umain.i} |\n\
> -   cc1 %{!pipe:%Umain.i} %1 \
> +  "jvgenmain %{D*} %b %{!pipe:%u.i} |\n\
> +   cc1 %{!pipe:%U.i} %1 \
> %{!Q:-quiet} -dumpbase %b.c %{d*} %{m*} %{a*}\
> %{g*} %{O*} \
> %{v:-version} %{pg:-p} %{p}\
> @@ -67,8 +67,8 @@ const char jvgenmain_spec[] =
> %{f*} -fdollars-in-identifiers\
> %{aux-info*}\
> %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
> -     %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%Umain.s}} |\n\
> -              %{!S:as %a %Y -o %d%w%umain%O %{!pipe:%Umain.s} %A\n }";
> +     %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%U.s}} |\n\
> +              %{!S:as %a %Y -o %d%w%u%O %{!pipe:%U.s} %A\n }";
> 
> /* Return full path name of spec file if it is in DIR, or NULL if
> not.  */
> @@ -528,8 +528,14 @@ lang_specific_pre_link ()
> int err;
> if (main_class_name == NULL)
> return 0;
> -  input_filename = main_class_name;
> -  input_filename_length = strlen (main_class_name);
> +  /* Append `main' to make the filename unique and allow
> +
> + gcj --main=hello -save-temps hello.java
> +
> +     to work.  jvgenmain needs to strip this `main' to arrive at the correct
> +     class name.  Append dummy `.c' that can be stripped by set_input so %b
> +     is correct.  */
> +  set_input (concat (main_class_name, "main.c", NULL));
> err = do_spec (jvgenmain_spec);
> if (err == 0)
> {
> 



More information about the Java mailing list