This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] Re: CVS 20010202 bootstrap error in libjava
- To: Mark Mitchell <mark at codesourcery dot com>
- Subject: [patch] Re: CVS 20010202 bootstrap error in libjava
- From: Bryce McKinlay <bryce at albatross dot co dot nz>
- Date: Sun, 04 Feb 2001 14:28:46 +1300
- CC: doko at cs dot tu-berlin dot de, java at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- References: <14972.29328.263499.793519@gargle.gargle.HOWL> <20010203143041K.mitchell@codesourcery.com>
Mark Mitchell wrote:
> >>>>> "Matthias" == Matthias Klose <doko@cs.tu-berlin.de> writes:
>
> Matthias> Is this another default situation?
>
> Yes, probably. I'll let the Java folks handle it, if that's OK, since
> they know that code far better than I.
I couldn't actually reproduce this problem here - libgcj.so is linking
libgcc_s.so already, so no undefined symbols.
> There are two options: build libgcj with -static-libgcc, or have gcj
> default to linking -shared-libgcc. I recommend the latter course of
> action; the former will not work at all on some systems, such as AIX.
Aah, we definatly want to use the shared libgcc (yay!), and heres a patch
to do so. This brings the size of a hello-world down from 90K to 19K on
i686 (4K stripped). Cool!
Unfortunately something seems to have broken "gcj -static". I'm getting:
/home/bryce/gcc/lib/gcc-lib/i686-pc-linux-gnu/2.97/collect2 -m elf_i386
-static -o ex /usr/lib/crt1.o /usr/lib/crti.o
/home/bryce/gcc/lib/gcc-lib/i686-pc-linux-gnu/2.97/crtbegin.o
-L/home/bryce/gcc/lib/gcc-lib/i686-pc-linux-gnu/2.97
-L/home/bryce/gcc/lib/gcc-lib/i686-pc-linux-gnu/2.97/../../..
/tmp/ccwUf19t.o /tmp/ccPLEY9lmain%O -lgcc -lgcj -lm -lgcjgc -lpthread
-lzgcj -ldl -lc -lgcc
/home/bryce/gcc/lib/gcc-lib/i686-pc-linux-gnu/2.97/crtend.o
/usr/lib/crtn.o
/home/bryce/gcc/lib/gcc-lib/i686-pc-linux-gnu/2.97/libgcc.a(_eh.o): In
function `__eh_rtime_match':
/home/bryce/cvs/gcc/build/gcc/../../gcc/libgcc2.c(.text+0x7f5): undefined
reference to `fwrite'
collect2: ld returned 1 exit status
I'm not sure if this is caused by my patch or if it was broken before.
Any ideas?
regards
[ bryce ]
2001-02-03 Bryce McKinlay <bryce@albatross.co.nz>
* Make-lang.in (jvspec.o): Add DRIVER_DEFINES to the list
of macros used when compiling jvspec.c.
* jvspec.c (lang_specific_driver): Link with the shared
libgcc by default.
2001-02-03 Bryce McKinlay <bryce@albatross.co.nz>
* libgcj.spec.in: Don't force static libgcc into the executable.
* configure.in (FORCELIBGCCSPEC): Removed.
Index: gcc/java/jvspec.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/jvspec.c,v
retrieving revision 1.34
diff -u -r1.34 jvspec.c
--- jvspec.c 2001/01/10 19:13:10 1.34
+++ jvspec.c 2001/02/04 01:16:27
@@ -1,6 +1,6 @@
/* Specific flags and argument handling of the front-end of the
GNU compiler for the Java(TM) language.
- Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of GNU CC.
@@ -44,6 +44,9 @@
static const char *main_class_name = NULL;
int lang_specific_extra_outfiles = 0;
+/* True if we should add -shared-libgcc to the command-line. */
+int shared_libgcc = 1;
+
/* Once we have the proper support in jc1 (and gcc.c) working,
set COMBINE_INPUTS to one. This enables combining multiple *.java
and *.class input files to be passed to a single jc1 invocation. */
@@ -305,6 +308,9 @@
will_link = 0;
continue;
}
+ else if (strcmp (argv[i], "-static-libgcc") == 0
+ || strcmp (argv[i], "-static") == 0)
+ shared_libgcc = 0;
else
/* Pass other options through. */
continue;
@@ -394,6 +400,14 @@
num_args++;
num_args++;
+ /* There's no point adding -shared-libgcc if we don't have a shared
+ libgcc. */
+#ifndef ENABLE_SHARED_LIBGCC
+ shared_libgcc = 0;
+#endif
+
+ num_args += shared_libgcc;
+
arglist = (const char **) xmalloc ((num_args + 1) * sizeof (char *));
for (i = 0, j = 0; i < argc; i++, j++)
@@ -485,6 +499,9 @@
arglist[j++] = "NONE";
#endif
}
+
+ if (shared_libgcc)
+ arglist[j++] = "-shared-libgcc";
arglist[j] = NULL;
Index: gcc/java/Make-lang.in
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/Make-lang.in,v
retrieving revision 1.49
diff -u -r1.49 Make-lang.in
--- Make-lang.in 2001/01/28 01:50:21 1.49
+++ Make-lang.in 2001/02/04 01:16:27
@@ -61,7 +61,7 @@
.PHONY: java
jvspec.o: $(srcdir)/java/jvspec.c system.h $(GCC_H) $(CONFIG_H)
- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) \
+ $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
$(INCLUDES) $(srcdir)/java/jvspec.c $(OUTPUT_OPTION)
# Create the compiler driver for $(GCJ).
Index: libjava/libgcj.spec.in
===================================================================
RCS file: /cvs/gcc/egcs/libjava/libgcj.spec.in,v
retrieving revision 1.12
diff -u -r1.12 libgcj.spec.in
--- libgcj.spec.in 2000/09/30 09:56:57 1.12
+++ libgcj.spec.in 2001/02/04 01:16:27
@@ -9,10 +9,8 @@
*jc1: @DIVIDESPEC@ @EXCEPTIONSPEC@ @JC1GCSPEC@ -fasynchronous-exceptions
#
-# libgcc should really be a shared library. This is a design flaw
-# that causes no end of mysterious problems. If we are using the
-# GNU linker, force parts of libgcc into the program file rather
-# than picking bits up from various shared libraries.
-#
+# On some systems we force in a data_start symbol so that the GC will work
+# with shared libraries.
+#
%rename startfile startfileorig
-*startfile: %(startfileorig) @LIBDATASTARTSPEC@ @FORCELIBGCCSPEC@
+*startfile: %(startfileorig) @LIBDATASTARTSPEC@
Index: libjava/configure.in
===================================================================
RCS file: /cvs/gcc/egcs/libjava/configure.in,v
retrieving revision 1.72
diff -u -r1.72 configure.in
--- configure.in 2001/01/12 19:16:04 1.72
+++ configure.in 2001/02/04 01:16:27
@@ -102,12 +102,6 @@
AC_DEFINE(SJLJ_EXCEPTIONS)
fi
-FORCELIBGCCSPEC=
-dnl Work around libgcc design flaw.
-if test "$ac_cv_prog_gnu_ld" = yes; then
- FORCELIBGCCSPEC="-u __rethrow -u __frame_state_for -lgcc"
-fi
-
AC_MSG_CHECKING([for data_start])
LIBDATASTARTSPEC=
NEEDS_DATA_START=
@@ -630,7 +624,6 @@
AC_SUBST(ZINCS)
AC_SUBST(DIVIDESPEC)
AC_SUBST(EXCEPTIONSPEC)
-AC_SUBST(FORCELIBGCCSPEC)
AM_CONDITIONAL(CANADIAN, test "$CANADIAN" = yes)
AM_CONDITIONAL(NULL_TARGET, test "$NULL_TARGET" = yes)