[vmkit-commits] [PATCH] Build vmkit into libjvm.so for dynamic loading

Will Dietz wdietz2 at illinois.edu
Tue Oct 25 17:01:29 PDT 2011


Inlined below (with some discussion).

Thanks!

~Will

>From 791034b1941b7c1ed63762c5c72804afa837877b Mon Sep 17 00:00:00 2001
From: Will Dietz <w at wdtz.org>
Date: Tue, 20 Sep 2011 18:18:38 -0500
Subject: [PATCH 1/3] Build vmkit into libjvm.so for dynamic loading

This is needed for OpenJDK support, to resolve libjava's dependency
on libjvm.so.

Technically we only need to export our OpenJDK implementation of misc
functions (JVM_*) through libjvm.so when j3 is the launcher, but to enable the
future ability to load vmkit /into/ the openjdk/icedtea launcher, having
libjvm.so contain all of vmkit is useful.

Note that presently Precompiled.a and BootstrapClases.a are not
built into libjvm.so, this is mostly to save time when hacking
on vmkit in ways that don't change the precompiled format.

Later, we probably want to include the precompiled stuff so that when
we're used in the 'java' launcher we can take advantage of it for fast
startup times.
---
 Makefile                   |    2 +-
 tools/j3/Makefile          |    4 +++-
 tools/jvm/Makefile         |   22 ++++++++++++++++++++++
 tools/precompiler/Makefile |    4 +++-
 4 files changed, 29 insertions(+), 3 deletions(-)
 create mode 100644 tools/jvm/Makefile

diff --git a/Makefile b/Makefile
index 4c14adc..7ad9e76 100644
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,7 @@ include $(LEVEL)/Makefile.config

 # Top-Level vmkit Build Stages:
 #
-DIRS := lib/Mvm/StaticGCPass lib/Mvm/StaticGCPrinter lib tools/vmjc
mmtk tools/precompiler tools
+DIRS := lib/Mvm/StaticGCPass lib/Mvm/StaticGCPrinter lib tools/vmjc
tools/jvm mmtk tools/precompiler tools

 EXTRA_DIST=include

diff --git a/tools/j3/Makefile b/tools/j3/Makefile
index b41625b..d5bad55 100755
--- a/tools/j3/Makefile
+++ b/tools/j3/Makefile
@@ -11,8 +11,10 @@ LEVEL = ../..
 include $(LEVEL)/Makefile.config

 TOOLNAME = j3
-USEDLIBS = Classpath.a J3.a J3Compiler.a Mvm.a MvmCompiler.a
CommonThread.a FinalMMTk.a InlineMMTk.a Precompiled.a
BootstrapClasses.a
+USEDLIBS = FinalMMTk.a InlineMMTk.a Precompiled.a BootstrapClasses.a
 BUILD_FRAMETABLE = 1
 LINK_COMPONENTS = jit nativecodegen scalaropts instrumentation ipa ipo

 include $(LEVEL)/Makefile.common
+
+LDFLAGS += -ljvm
diff --git a/tools/jvm/Makefile b/tools/jvm/Makefile
new file mode 100644
index 0000000..88b7303
--- /dev/null
+++ b/tools/jvm/Makefile
@@ -0,0 +1,22 @@
+##===- tools/jvm/Makefile ----------------------------------*-
Makefile -*-===##
+#
+#                     The vmkit project
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+LEVEL = ../..
+
+include $(LEVEL)/Makefile.config
+
+LIBRARYNAME=jvm
+SHARED_LIBRARY := 1
+LINK_LIBS_IN_SHARED :=1
+
+USEDLIBS = J3.a Classpath.a J3Compiler.a Mvm.a MvmCompiler.a CommonThread.a
+
+include $(LEVEL)/Makefile.common
+
+USEDLIBS_FULL = $(addprefix $(LibDir)/lib,$(USEDLIBS))
+LDFLAGS += -Wl,-whole-archive $(USEDLIBS_FULL) -Wl,-no-whole-archive
diff --git a/tools/precompiler/Makefile b/tools/precompiler/Makefile
index 228025a..6d61eb1 100755
--- a/tools/precompiler/Makefile
+++ b/tools/precompiler/Makefile
@@ -12,8 +12,10 @@ include $(LEVEL)/Makefile.config

 DIRS = trainer
 TOOLNAME = precompiler
-USEDLIBS = Classpath.a J3.a J3Compiler.a Mvm.a MvmCompiler.a
CommonThread.a FinalMMTk.a
+USEDLIBS = FinalMMTk.a
 BUILD_FRAMETABLE = 1
 LINK_COMPONENTS = jit nativecodegen scalaropts instrumentation ipa
ipo asmparser linker bitwriter

 include $(LEVEL)/Makefile.common
+
+LDFLAGS += -ljvm
-- 
1.7.5.1



More information about the vmkit-commits mailing list