diff -Nur gcj-4.3-4.3.0.orig/debian/patches/libjava-disable-static.dpatch gcj-4.3-4.3.0/debian/patches/libjava-disable-static.dpatch
--- gcj-4.3-4.3.0.orig/debian/patches/libjava-disable-static.dpatch	2008-04-18 11:18:56.000000000 +0200
+++ gcj-4.3-4.3.0/debian/patches/libjava-disable-static.dpatch	1970-01-01 01:00:00.000000000 +0100
@@ -1,45 +0,0 @@
-#! /bin/sh -e
-
-# DP: Disable building the static libjava.
-
-dir=
-if [ $# -eq 3 -a "$2" = '-d' ]; then
-    pdir="-d $3"
-    dir="$3/"
-elif [ $# -ne 1 ]; then
-    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
-    exit 1
-fi
-case "$1" in
-    -patch)
-        patch $pdir -f --no-backup-if-mismatch -p0 < $0
-        ;;
-    -unpatch)
-        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
-        ;;
-    *)
-        echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
-        exit 1
-esac
-exit 0
-
---- Makefile.in~	2007-03-26 10:44:16.881179540 +0200
-+++ Makefile.in	2007-03-26 10:48:27.564961048 +0200
-@@ -43901,7 +43901,7 @@
- 	rm -f no-such-file || : ; \
- 	CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
- 	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
--	  --target=${target_alias} $${srcdiroption}  \
-+	  --target=${target_alias} --disable-static $${srcdiroption}  \
- 	  || exit 1
- @endif target-libjava
- 
-@@ -44783,7 +44783,7 @@
- 	rm -f no-such-file || : ; \
- 	CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
- 	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
--	  --target=${target_alias} $${srcdiroption}  \
-+	  --target=${target_alias} --disable-static $${srcdiroption}  \
- 	  || exit 1
- @endif target-boehm-gc
- 
diff -Nur gcj-4.3-4.3.0.orig/debian/patches/libjava-sven-ola.dpatch gcj-4.3-4.3.0/debian/patches/libjava-sven-ola.dpatch
--- gcj-4.3-4.3.0.orig/debian/patches/libjava-sven-ola.dpatch	1970-01-01 01:00:00.000000000 +0100
+++ gcj-4.3-4.3.0/debian/patches/libjava-sven-ola.dpatch	2008-04-18 11:39:39.000000000 +0200
@@ -0,0 +1,114 @@
+#! /bin/sh -e
+
+# DP: Disable building the static libjava.
+
+dir=
+if [ $# -eq 3 -a "$2" = '-d' ]; then
+    pdir="-d $3"
+    dir="$3/"
+elif [ $# -ne 1 ]; then
+    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+    exit 1
+fi
+case "$1" in
+    -patch)
+        patch $pdir -f --no-backup-if-mismatch -p0 < $0
+        ;;
+    -unpatch)
+        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
+        ;;
+    *)
+        echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+        exit 1
+esac
+exit 0
+
+--- Makefile.in~	2007-03-26 10:44:16.881179540 +0200
++++ Makefile.in	2007-03-26 10:48:27.564961048 +0200
+@@ -43901,7 +43901,7 @@
+ 	rm -f no-such-file || : ; \
+ 	CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
+ 	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
+-	  --target=${target_alias} $${srcdiroption}  \
++	  --target=${target_alias} --with-pic $${srcdiroption}  \
+ 	  || exit 1
+ @endif target-libjava
+ 
+@@ -44783,7 +44783,7 @@
+ 	rm -f no-such-file || : ; \
+ 	CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
+ 	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
+-	  --target=${target_alias} $${srcdiroption}  \
++	  --target=${target_alias} --with-pic $${srcdiroption}  \
+ 	  || exit 1
+ @endif target-boehm-gc
+ 
+diff -Nur src.orig/boehm-gc/include/gc.h src/boehm-gc/include/gc.h
+--- boehm-gc/include/gc.h	2007-04-23 23:10:09.000000000 +0200
++++ boehm-gc/include/gc.h	2008-04-18 09:01:02.000000000 +0200
+@@ -426,6 +426,8 @@
+ /* Includes some pages that were allocated but never written.		*/
+ GC_API size_t GC_get_heap_size GC_PROTO((void));
+ 
++GC_API size_t GC_get_max_heap_size GC_PROTO((void));
++
+ /* Return a lower bound on the number of free bytes in the heap.	*/
+ GC_API size_t GC_get_free_bytes GC_PROTO((void));
+ 
+diff -Nur src.orig/boehm-gc/misc.c src/boehm-gc/misc.c
+--- boehm-gc/misc.c	2006-09-14 20:06:04.000000000 +0200
++++ boehm-gc/misc.c	2008-04-18 11:09:30.000000000 +0200
+@@ -451,6 +451,11 @@
+     return ((size_t) GC_heapsize);
+ }
+ 
++size_t GC_get_max_heap_size GC_PROTO(())
++{
++    return ((size_t) GC_max_heapsize);
++}
++
+ size_t GC_get_free_bytes GC_PROTO(())
+ {
+     return ((size_t) GC_large_free_bytes);
+diff -Nur src.orig/libjava/boehm.cc src/libjava/boehm.cc
+--- libjava/boehm.cc	2007-10-22 23:24:35.000000000 +0200
++++ libjava/boehm.cc	2008-04-18 09:00:01.000000000 +0200
+@@ -446,6 +446,12 @@
+ }
+ 
+ long
++_Jv_GCMaxMemory (void)
++{
++  return GC_get_max_heap_size ();
++}
++
++long
+ _Jv_GCFreeMemory (void)
+ {
+   return GC_get_free_bytes ();
+diff -Nur src.orig/libjava/include/jvm.h src/libjava/include/jvm.h
+--- libjava/include/jvm.h	2007-10-22 23:24:35.000000000 +0200
++++ libjava/include/jvm.h	2008-04-18 09:00:01.000000000 +0200
+@@ -391,6 +391,8 @@
+ 
+ /* Return approximation of total size of heap.  */
+ long _Jv_GCTotalMemory (void);
++/* Return max size of heap.  */
++long _Jv_GCMaxMemory (void);
+ /* Return approximation of total free memory.  */
+ long _Jv_GCFreeMemory (void);
+ 
+diff -Nur src.orig/libjava/java/lang/natRuntime.cc src/libjava/java/lang/natRuntime.cc
+--- libjava/java/lang/natRuntime.cc	2007-03-05 16:57:13.000000000 +0100
++++ libjava/java/lang/natRuntime.cc	2008-04-18 08:58:16.000000000 +0200
+@@ -275,9 +275,7 @@
+ jlong
+ java::lang::Runtime::maxMemory (void)
+ {
+-  // We don't have a maximum.  FIXME: we might if we ask the GC for
+-  // one.
+-  return Long::MAX_VALUE;
++  return _Jv_GCMaxMemory ();
+ }
+ 
+ void
diff -Nur gcj-4.3-4.3.0.orig/debian/README.Debian gcj-4.3-4.3.0/debian/README.Debian
--- gcj-4.3-4.3.0.orig/debian/README.Debian	2008-04-18 11:18:56.000000000 +0200
+++ gcj-4.3-4.3.0/debian/README.Debian	2008-04-18 11:38:15.000000000 +0200
@@ -122,8 +122,8 @@
   Retry the build on an ice, save the calling options and preprocessed
   source when the ice is reproducible.
 
-libjava-disable-static:
-  Disable building the static libjava.
+libjava-sven-ola:
+  Use --with-pic for libgjc.a and add GC_get_max_heap_size()
 
 gcc-ice-apport:
   Report an ICE to apport (if apport is available
diff -Nur gcj-4.3-4.3.0.orig/debian/rules.patch gcj-4.3-4.3.0/debian/rules.patch
--- gcj-4.3-4.3.0.orig/debian/rules.patch	2008-04-18 11:18:56.000000000 +0200
+++ gcj-4.3-4.3.0/debian/rules.patch	2008-04-18 11:38:17.000000000 +0200
@@ -154,7 +154,7 @@
 endif
 
 debian_patches += multiarch-include
-debian_patches += gcc-ice-hack libjava-disable-static
+debian_patches += gcc-ice-hack libjava-sven-ola
 debian_patches += gcc-ice-apport
 
 ifeq ($(biarch),yes)
