Fwd: cross compile OpenJDK-9+158 minimal variant failed when link libjvm.so (original) (raw)

Zhu Yong zhuyong.me at gmail.com
Wed Mar 1 05:39:26 UTC 2017


Thank you for the information, I managed to make minimal build pass now.

Initially I though JVM_EXCLUDE_FILES need to add additional 3 generated files (they appeared in _BUILD_LIBJVM_objectfilenames.txt) : bytecodeInterpreterWithChecks.cpp jvmtiEnter.cpp jvmtiEnterTrace.cpp But build still fail with same error message.

Finally I figured out it's due to those 8 doit() functions implementation in jvmtiEnvBase.hpp file. After move all those 8 doit() implementations to jvmtiEnvBase.cpp, build of minimal VM passed without any issue.

Changes appended


.../src/share/vm/prims/jvmtiEnvBase.cpp | 74 ++++++++++++++++++++++ .../src/share/vm/prims/jvmtiEnvBase.hpp | 68 +++----------------- 2 files changed, 82 insertions(+), 60 deletions(-) mode change 100644 => 100755 hotspot-9211c2e89c1c/src/share/vm/prims/jvmtiEnvBase.cpp mode change 100644 => 100755 hotspot-9211c2e89c1c/src/share/vm/prims/jvmtiEnvBase.hpp

diff --git a/hotspot-9211c2e89c1c/src/share/vm/prims/jvmtiEnvBase.cpp b/hotspot-9211c2e89c1c/src/share/vm/prims/jvmtiEnvBase.cpp old mode 100644 new mode 100755 index dd241a0..e5832ba --- a/hotspot-9211c2e89c1c/src/share/vm/prims/jvmtiEnvBase.cpp +++ b/hotspot-9211c2e89c1c/src/share/vm/prims/jvmtiEnvBase.cpp @@ -1283,6 +1283,80 @@ VM_GetMultipleStackTraces::allocate_and_fill_stacks(jint thread_count) { "the last copied frame info must be the last record"); }

+void +VM_UpdateForPopTopFrame::doit() {

NULL) {

_java_thread, + _owned_monitors_list);

*)_env)->get_current_contended_monitor(_calling_thread,_java_thread,_owned_monitor_ptr);

NULL) {

_max_count,

_count_ptr);

_depth,

_location_ptr);

void VM_GetThreadListStackTraces::doit() { diff --git a/hotspot-9211c2e89c1c/src/share/vm/prims/jvmtiEnvBase.hpp b/hotspot-9211c2e89c1c/src/share/vm/prims/jvmtiEnvBase.hpp old mode 100644 new mode 100755 index 04e6869..00b9890 --- a/hotspot-9211c2e89c1c/src/share/vm/prims/jvmtiEnvBase.hpp +++ b/hotspot-9211c2e89c1c/src/share/vm/prims/jvmtiEnvBase.hpp @@ -359,14 +359,7 @@ public: } VMOp_Type type() const { return VMOp_UpdateForPopTopFrame; } jvmtiError result() { return _result; }

NULL) {

// VM operation to set frame pop. @@ -389,15 +382,7 @@ public: bool allow_nested_vm_operations() const { return true; } VMOp_Type type() const { return VMOp_SetFramePop; } jvmtiError result() { return _result; } - void doit() { - JavaThread* jt = _state->get_thread(); - if (Threads::includes(jt) && !jt->is_exiting() && jt->threadObj() != NULL) { - int frame_number = _state->count_frames() - _depth;

_state->env_thread_state((JvmtiEnvBase*)_env)->set_frame_pop(frame_number);

@@ -421,14 +406,7 @@ public: _result = JVMTI_ERROR_NONE; } VMOp_Type type() const { return VMOp_GetOwnedMonitorInfo; } - void doit() { - _result = JVMTI_ERROR_THREAD_NOT_ALIVE; - if (Threads::includes(_java_thread) && !_java_thread->is_exiting() - && _java_thread->threadObj() != NULL) { - _result = ((JvmtiEnvBase *)_env)->get_owned_monitors(_calling_thread, _java_thread,

_owned_monitors_list);

@@ -451,10 +429,7 @@ public: } VMOp_Type type() const { return VMOp_GetObjectMonitorUsage; } jvmtiError result() { return _result; } - void doit() { - _result = ((JvmtiEnvBase*) _env)->get_object_monitor_usage(_calling_thread, _object, _info_ptr); - }

// VM operation to get current contended monitor. @@ -475,13 +450,7 @@ public: } VMOp_Type type() const { return VMOp_GetCurrentContendedMonitor; } jvmtiError result() { return _result; }

*)_env)->get_current_contended_monitor(_calling_thread,_java_thread,_owned_monitor_ptr);

// VM operation to get stack trace at safepoint. @@ -508,15 +477,7 @@ public: } jvmtiError result() { return _result; } VMOp_Type type() const { return VMOp_GetStackTrace; }

NULL) {

_max_count,

_count_ptr);

// forward declaration @@ -606,13 +567,7 @@ public: } VMOp_Type type() const { return VMOp_GetFrameCount; } jvmtiError result() { return _result; }

NULL) {

// VM operation to frame location at safepoint. @@ -636,14 +591,7 @@ public: } VMOp_Type type() const { return VMOp_GetFrameLocation; } jvmtiError result() { return _result; }

_depth,

_location_ptr);

-- 2.1.4

On Tue, Feb 28, 2017 at 6:11 PM, David Holmes <david.holmes at oracle.com> wrote:

On 28/02/2017 7:35 PM, David Holmes wrote:

On 28/02/2017 6:51 PM, Zhu Yong wrote:

Dear All,

I am testing cross compile OpenJDK-9+158 for our embedded system using buildroot, I can build server and client variants successfully, but the output compact1 profile file size is too big, then I tried to build minimal variant, failed when linking libjvm.so. I checked build/linux-arm-normal-minimal-release/hotspot/variant- minimal/ libjvm/objs/BUILDLIBJVMobjectfilenames.txt, jvmtiEnvBase.o and jvmtiEnvThreadState.o are not listed in the file (which is required from the error message below).

Right - JVM TI is not part of the Minimal VM. At the moment it looks like some service has either been enabled when it should not have been, or has not been correctly if'def in the source. As far as I can see your error messages are complaining about missing functions that are called from the same sources as the functions that are missing! ie. undefined reference to JvmtiEnvBase::getcurrentcontendedmonitor(JavaThread*, JavaThread*,_ _jobject**)'_ _/tmp/cc27HS5M.ltrans0.ltrans.o: In function VMGetOwnedMonitorInfo::doit( ) but VMGetOwnedMonitorInfo is defined in jvmtiEnv.cpp which should be included or excluded the same as jvmtiEnBase.cpp. Here's the logic in the makefile that controls this: ifneq ($(call check-jvm-feature, jvmti), true) JVMCFLAGSFEATURES += -DINCLUDEJVMTI=0 JVMEXCLUDEFILES += jvmtiGetLoadedClasses.cpp jvmtiThreadState.cpp _jvmtiExtensions.cpp _ jvmtiImpl.cpp jvmtiManageCapabilities.cpp jvmtiRawMonitor.cpp _jvmtiUtil.cpp jvmtiTrace.cpp _ jvmtiCodeBlobEvents.cpp jvmtiEnv.cpp jvmtiRedefineClasses.cpp _jvmtiEnvBase.cpp jvmtiEnvThreadState.cpp _ jvmtiTagMap.cpp jvmtiEventController.cpp evmCompat.cpp _jvmtiEnter.xsl jvmtiExport.cpp _ jvmtiClassFileReconstituter.cpp endif Can you run with LOG=trace so that each compiled file is listed in the build log, then see if there are any jvmti* files listed there. Thanks, David Can you provide the lines from your spec.gmk that define the JVMFEATURES* variables please. Thanks, David ------ === Output from failing command(s) repeated here === * For target hotspotvariant-minimallibjvmobjsBUILDLIBJVMlink: /tmp/cc27HS5M.ltrans0.ltrans.o: In function VMGetStackTrace::doit()_ _[clone .local.640]':_ _cc27HS5M.ltrans0.o:(.text+0xce5e): undefined reference to_ _JvmtiEnvBase::getstacktrace(JavaThread*, int, int, jvmtiFrameInfo*, int*)' /tmp/cc27HS5M.ltrans0.ltrans.o: In function VMGetCurrentContendedMonitor::doit()_ _[clone .local.639]':_ _cc27HS5M.ltrans0.o:(.text+0xcec2): undefined reference to_ _JvmtiEnvBase::getcurrentcontendedmonitor(JavaThread*, JavaThread*, jobject**)' /tmp/cc27HS5M.ltrans0.ltrans.o: In function VMGetOwnedMonitorInfo::doit()_ _[clone .local.638]':_ _cc27HS5M.ltrans0.o:(.text+0xcf26): undefined reference to_ _JvmtiEnvBase::getownedmonitors(JavaThread*, JavaThread*, GrowableArray<_ _jvmtiMonitorStackDepthInfo*>*)' /tmp/cc27HS5M.ltrans0.ltrans.o: In function VMGetFrameCount::doit()_ _[clone .local.637]':_ _cc27HS5M.ltrans0.o:(.text+0xcf8a): undefined reference to_ _JvmtiEnvBase::getframecount(JvmtiThreadState*, int*)' /tmp/cc27HS5M.ltrans0.ltrans.o: In function VMSetFramePop::doit()_ _[clone_ _.local.636]':_ _cc27HS5M.ltrans0.o:(.text+0xcfea): undefined reference to_ _JvmtiThreadState::countframes()' cc27HS5M.ltrans0.o:(.text+0xd030): undefined reference to JvmtiEnvThreadState::setframepop(int)'_ _/tmp/cc27HS5M.ltrans0.ltrans.o: In function VMGetFrameLocation::doit() [clone .local.641]': ... (rest of output omitted)

My configuration: _--with-jdk-variant=normal _ _--with-jvm-variants=minimal _ _--with-debug-level=release _ _--disable-warnings-as-errors _ _--disable-hotspot-gtest _ _--with-abi-profile=arm-vfp-sflt _ _--openjdk-target=$(GNUTARGETNAME) _ _--with-sys-root=$(STAGINGDIR) _ _--with-tools-dir=$(HOSTDIR) _ _--with-freetype-include=$(STAGINGDIR)/usr/include _ _--with-freetype-lib=$(STAGINGDIR)/usr/lib _ _--with-freetype=$(STAGINGDIR)/usr/ _ _--with-alsa-include=$(STAGINGDIR)/usr/include _ _--with-alsa-lib=$(STAGINGDIR)/usr/lib _ _--with-alsa=$(STAGINGDIR)/usr/ _ _--with-cups=$(STAGINGDIR)/usr/ _ _--with-x=$(STAGINGDIR)/usr/include _ _--with-extra-ldflags=--sysroot=$(STAGINGDIR) _ _--enable-headless-only _ _--disable-freetype-bundling _ _--enable-unlimited-crypto _ --with-boot-jdk=/opt/java/jdk1.8.0102



More information about the build-dev mailing list