This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch: 3.0 and trunk: gcj, gcc.c, and %O
- To: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Subject: Patch: 3.0 and trunk: gcj, gcc.c, and %O
- From: Tom Tromey <tromey at redhat dot com>
- Date: 10 May 2001 17:09:09 -0600
- Reply-To: tromey at redhat dot com
If you link a simple Java program with `-v' you'll see something odd:
creche. gcj -v --main=HelloWorld -o H HelloWorld.o
[ ... ]
as -V -Qy -o /tmp/cccL8Gypmain%O /tmp/ccGHLIAKmain.s
The odd thing is the `%O'.
This %O comes from a spec in gcc/java/jvspec.c:
[ ... ]
%{!S:as %a %Y -o %d%w%umain%O %{!pipe:%Umain.s} %A\n }";
I think this %O should be changed to `.o' by the driver.
And in fact I tracked this down to a bug in gcc.c.
Here is the fix. I am not really sure how to test it completely. I
don't know every possible use of `%O' in every spec.
However, it does do the right thing for gcj, and the resulting
compiler does work on my x86 Linux box -- it managed to rebuild all
the target libraries.
If you read the old code you can see it is clearly wrong -- it
computes `saved_suffix' but then never actually uses it.
I would like to check this in on the branch and the trunk.
Ok?
2001-05-10 Tom Tromey <tromey@redhat.com>
* gcc.c (do_spec_1): In `%O' case, if we computed saved_suffix,
use it in the new association.
Tom
Index: gcc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcc.c,v
retrieving revision 1.205.2.10
diff -u -r1.205.2.10 gcc.c
--- gcc.c 2001/05/01 18:56:21 1.205.2.10
+++ gcc.c 2001/05/10 22:31:06
@@ -4281,7 +4281,8 @@
&& t->unique == (c != 'g'))
break;
- /* Make a new association if needed. %u and %j require one. */
+ /* Make a new association if needed. %u and %j
+ require one. */
if (t == 0 || c == 'u' || c == 'j')
{
if (t == 0)
@@ -4291,7 +4292,13 @@
temp_names = t;
}
t->length = suffix_length;
- t->suffix = save_string (suffix, suffix_length);
+ if (saved_suffix)
+ {
+ t->suffix = saved_suffix;
+ saved_suffix = NULL;
+ }
+ else
+ t->suffix = save_string (suffix, suffix_length);
t->unique = (c != 'g');
temp_filename = make_temp_file (t->suffix);
temp_filename_length = strlen (temp_filename);