public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] libjava: Add option to disable BC ABI in libgcj.
@ 2007-12-21 22:25 David Daney
  2007-12-21 23:40 ` Tom Tromey
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: David Daney @ 2007-12-21 22:25 UTC (permalink / raw)
  To: Java Patch List; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1274 bytes --]

Static linking with libgcj does not work well when portions are compiled
with the BC ABI.  The problem is that the compile time linker is not
able to resolve all the needed dependencies.

This patch adds a new configure option (--disable-libgcj-bc) that forces
all code in libgcj to be compiled with the C++ ABI.  The default is to
compile libgcj 'normally'.  This option would only be used by those
statically linking to libgcj.

Tested on i686-pc-linux-gnu with no failures in libjava testsuite.  I
also verified by inspecting build output that -findirect-dispatch
-fno-indirect-classes is being passed when compiling the BC ABI files.

OK to commit?

gcc/
2007-12-21  David Daney  <ddaney@avtrex.com>

    * doc/install.texi (disable-libgcj-bc): Document new option.

libjava/
2007-12-21  David Daney  <ddaney@avtrex.com>

    * scripts/makemake.tcl (emit_bc_rule): Use $(LIBGCJ_BC_FLAGS)
    instead of -findirect-dispatch -fno-indirect-classes.
    * configure.ac (libgcj-bc): New AC_ARG_ENABLE.
    (SUPPRESS_LIBGCJ_BC): New AM_CONDITIONAL.
    * Makefile.am (LIBGCJ_BC_FLAGS): New variable.
    * Makefile.in: Regenerate.
    * include/Makefile.in: Same.
    * testsuite/Makefile.in: Same.
    * configure: Same.
    * gcj/Makefile.in: Same.
    * sources.am: Same.


[-- Attachment #2: libgcj-bc.diff --]
[-- Type: text/x-patch, Size: 2681 bytes --]

Index: gcc/doc/install.texi
===================================================================
--- gcc/doc/install.texi	(revision 131121)
+++ gcc/doc/install.texi	(working copy)
@@ -1554,6 +1554,16 @@ using non-functional stubs for native me
 @item --disable-jvmpi
 Disable JVMPI support.
 
+@item --disable-libgcj-bc
+Disable BC ABI compilation of certain parts of libgcj.  By default,
+some portions of libgcj are compiled with @option{-findirect-dispatch}
+@option{-fno-indirect-classes}.  This allows them to be overridden at
+runtime.
+
+If @option{--disable-libgcj-bc} is specified, libgcj is built without
+these options.  This makes it impossible to override portions of
+libgcj at runtime, but can make it easier to statically link to libgcj.
+
 @item --with-ecos
 Enable runtime eCos target support.
 
Index: libjava/scripts/makemake.tcl
===================================================================
--- libjava/scripts/makemake.tcl	(revision 131121)
+++ libjava/scripts/makemake.tcl	(working copy)
@@ -317,7 +317,9 @@ proc emit_bc_rule {package} {
   if {$package_map($package) == "bc"} {
     puts -nonewline "-fjni "
   }
-  puts "-findirect-dispatch -fno-indirect-classes -c -o $loname @$tname"
+  # Unless bc is disabled with --disable-libgcj-bc, $(LIBGCJ_BC_FLAGS) is:
+  #   -findirect-dispatch -fno-indirect-classes
+  puts "\$(LIBGCJ_BC_FLAGS) -c -o $loname @$tname"
   puts "\t@rm -f $tname"
   puts ""
 
Index: libjava/configure.ac
===================================================================
--- libjava/configure.ac	(revision 131121)
+++ libjava/configure.ac	(working copy)
@@ -514,6 +514,15 @@ AC_ARG_WITH(java-home,
 AM_CONDITIONAL(JAVA_HOME_SET, test ! -z "$JAVA_HOME")
 AC_SUBST(JAVA_HOME)
 
+suppress_libgcj_bc=no
+AC_ARG_ENABLE(libgcj-bc,
+  AS_HELP_STRING([--enable-libgcj-bc],
+                 [enable(default) or disable BC ABI for portions of libgcj]),
+  [if test "$enable_libgcj_bc" = "no"; then
+     suppress_libgcj_bc=yes
+   fi])
+AM_CONDITIONAL(SUPPRESS_LIBGCJ_BC, test "$suppress_libgcj_bc" = "yes")
+
 # What is the native OS API for MinGW?
 AC_ARG_WITH(win32-nlsapi,
   AS_HELP_STRING([--with-win32-nlsapi=ansi or unicows or unicode],
Index: libjava/Makefile.am
===================================================================
--- libjava/Makefile.am	(revision 131121)
+++ libjava/Makefile.am	(working copy)
@@ -155,6 +155,12 @@ if USING_GCC
 AM_CFLAGS += $(WARNINGS)
 endif
 
+if SUPPRESS_LIBGCJ_BC
+LIBGCJ_BC_FLAGS =
+else
+LIBGCJ_BC_FLAGS = -findirect-dispatch -fno-indirect-classes
+endif
+
 ## Extra CFLAGS used for JNI C sources shared with GNU Classpath.
 PEDANTIC_CFLAGS = -ansi -pedantic -Wall -Wno-long-long
 

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2008-01-28 10:23 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-21 22:25 [PATCH] libjava: Add option to disable BC ABI in libgcj David Daney
2007-12-21 23:40 ` Tom Tromey
2007-12-22 11:19 ` Andrew Haley
2007-12-30 14:31 ` Gerald Pfeifer
2008-01-26  5:18   ` David Daney
2008-01-26 10:51     ` Andrew Haley
2008-01-26 21:50       ` David Daney
2008-01-27 10:34         ` Andrew Haley
2008-01-28  0:09           ` Gerald Pfeifer
2008-01-28  4:38             ` David Daney
2008-01-28 10:23               ` Andrew Haley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).