Fwd: cross compile OpenJDK-9+158 minimal variant failed when link libjvm.so (original) (raw)
David Holmes david.holmes at oracle.com
Wed Mar 1 05:56:46 UTC 2017
- Previous message (by thread): Fwd: cross compile OpenJDK-9+158 minimal variant failed when link libjvm.so
- Next message (by thread): Fwd: cross compile OpenJDK-9+158 minimal variant failed when link libjvm.so
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 1/03/2017 3:39 PM, Zhu Yong wrote:
Thank you for the information, I managed to make minimal build pass now.
Initially I though JVMEXCLUDEFILES need to add additional 3 generated files (they appeared in BUILDLIBJVMobjectfilenames.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.
That seems to be a compiler issue. jvmtiEnvBase.hpp is unconditionally included in a couple of places because we have to have enough of the JVMTI code to say JVMTI is not available. Those doit() implementations, though arguably could be conditional on INCLUDE_JVMTI, are not referenced by any called code and so should not linked in. But in your case it seems they are.
What toolchain are you using?
David
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 @@ VMGetMultipleStackTraces::allocateandfillstacks(jint threadcount) { "the last copied frame info must be the last record"); } +void +VMUpdateForPopTopFrame::doit() { + JavaThread* jt = state->getthread(); + if (Threads::includes(jt) && !jt->isexiting() && jt->threadObj() != NULL) { + state->updateforpoptopframe(); + } else { + result = JVMTIERRORTHREADNOTALIVE; + } +} + +void +VMSetFramePop::doit() { + JavaThread* jt = state->getthread(); + if (Threads::includes(jt) && !jt->isexiting() && jt->threadObj() != NULL) { + int framenumber = state->countframes() - depth; + state->envthreadstate((JvmtiEnvBase*)env)->setframepop(framenumber); + } else { + result = JVMTIERRORTHREADNOTALIVE; + } +} + +void +VMGetOwnedMonitorInfo::doit() { + result = JVMTIERRORTHREADNOTALIVE; + if (Threads::includes(javathread) && !javathread->isexiting() + && javathread->threadObj() != NULL) { + result = ((JvmtiEnvBase *)env)->getownedmonitors(callingthread, javathread, + ownedmonitorslist); + } +} + +void +VMGetObjectMonitorUsage::doit() { + result = ((JvmtiEnvBase*) env)->getobjectmonitorusage(callingthread, object, infoptr); +} + +void +VMGetCurrentContendedMonitor::doit() { + result = JVMTIERRORTHREADNOTALIVE; + if (Threads::includes(javathread) && !javathread->isexiting() && + javathread->threadObj() != NULL) { + result = ((JvmtiEnvBase *)env)->getcurrentcontendedmonitor(callingthread,javathread,ownedmonitorptr); + } +} + +void +VMGetStackTrace::doit() { + result = JVMTIERRORTHREADNOTALIVE; + if (Threads::includes(javathread) && !javathread->isexiting() + && javathread->threadObj() != NULL) { + result = ((JvmtiEnvBase *)env)->getstacktrace(javathread, + startdepth, maxcount, + framebuffer, countptr); + } +} + +void +VMGetFrameCount::doit() { + result = JVMTIERRORTHREADNOTALIVE; + JavaThread* jt = state->getthread(); + if (Threads::includes(jt) && !jt->isexiting() && jt->threadObj() != NULL) { + result = ((JvmtiEnvBase*)env)->getframecount(state, countptr); + } +} + +void +VMGetFrameLocation::doit() { + result = JVMTIERRORTHREADNOTALIVE; + if (Threads::includes(javathread) && !javathread->isexiting() && + javathread->threadObj() != NULL) { + result = ((JvmtiEnvBase*)env)->getframelocation(javathread, depth, + methodptr, locationptr); + } +} void VMGetThreadListStackTraces::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: } VMOpType type() const { return VMOpUpdateForPopTopFrame; } jvmtiError result() { return result; } - void doit() { - JavaThread* jt = state->getthread(); - if (Threads::includes(jt) && !jt->isexiting() && jt->threadObj() != NULL) { - state->updateforpoptopframe(); - } else { - result = JVMTIERRORTHREADNOTALIVE; - } - } + void doit(); }; // VM operation to set frame pop. @@ -389,15 +382,7 @@ public: bool allownestedvmoperations() const { return true; } VMOpType type() const { return VMOpSetFramePop; } jvmtiError result() { return result; } - void doit() { - JavaThread* jt = state->getthread(); - if (Threads::includes(jt) && !jt->isexiting() && jt->threadObj() != NULL) { - int framenumber = state->countframes() - depth; - state->envthreadstate((JvmtiEnvBase*)env)->setframepop(framenumber); - } else { - result = JVMTIERRORTHREADNOTALIVE; - } - } + void doit(); };
@@ -421,14 +406,7 @@ public: result = JVMTIERRORNONE; } VMOpType type() const { return VMOpGetOwnedMonitorInfo; } - void doit() { - result = JVMTIERRORTHREADNOTALIVE; - if (Threads::includes(javathread) && !javathread->isexiting() - && javathread->threadObj() != NULL) { - result = ((JvmtiEnvBase *)env)->getownedmonitors(callingthread, javathread, - ownedmonitorslist); - } - } + void doit(); jvmtiError result() { return result; } }; @@ -451,10 +429,7 @@ public: } VMOpType type() const { return VMOpGetObjectMonitorUsage; } jvmtiError result() { return result; } - void doit() { - result = ((JvmtiEnvBase*) env)->getobjectmonitorusage(callingthread, object, infoptr); - } - + void doit(); }; // VM operation to get current contended monitor. @@ -475,13 +450,7 @@ public: } VMOpType type() const { return VMOpGetCurrentContendedMonitor; } jvmtiError result() { return result; } - void doit() { - result = JVMTIERRORTHREADNOTALIVE; - if (Threads::includes(javathread) && !javathread->isexiting() && - javathread->threadObj() != NULL) { - result = ((JvmtiEnvBase *)env)->getcurrentcontendedmonitor(callingthread,javathread,ownedmonitorptr); - } - } + void doit(); }; // VM operation to get stack trace at safepoint. @@ -508,15 +477,7 @@ public: } jvmtiError result() { return result; } VMOpType type() const { return VMOpGetStackTrace; } - void doit() { - result = JVMTIERRORTHREADNOTALIVE; - if (Threads::includes(javathread) && !javathread->isexiting() - && javathread->threadObj() != NULL) { - result = ((JvmtiEnvBase *)env)->getstacktrace(javathread, - startdepth, maxcount, - framebuffer, countptr); - } - } + void doit(); }; // forward declaration @@ -606,13 +567,7 @@ public: } VMOpType type() const { return VMOpGetFrameCount; } jvmtiError result() { return result; } - void doit() { - result = JVMTIERRORTHREADNOTALIVE; - JavaThread* jt = state->getthread(); - if (Threads::includes(jt) && !jt->isexiting() && jt->threadObj() != NULL) { - result = ((JvmtiEnvBase*)env)->getframecount(state, countptr); - } - } + void doit(); }; // VM operation to frame location at safepoint. @@ -636,14 +591,7 @@ public: } VMOpType type() const { return VMOpGetFrameLocation; } jvmtiError result() { return result; } - void doit() { - result = JVMTIERRORTHREADNOTALIVE; - if (Threads::includes(javathread) && !javathread->isexiting() && - javathread->threadObj() != NULL) { - result = ((JvmtiEnvBase*)env)->getframelocation(javathread, depth, - methodptr, locationptr); - } - } + void doit(); }; -- 2.1.4 On Tue, Feb 28, 2017 at 6:11 PM, David Holmes <david.holmes at oracle.com_ _<mailto: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, DavidCan 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 functionVMGetCurrentContendedMonitor::doit()_ _[clone .local.639]':_ _cc27HS5M.ltrans0.o:(.text+0xcec2): undefined reference to_ _
JvmtiEnvBase::getcurrentcontendedmonitor(JavaThread*, JavaThread*, jobject**)' /tmp/cc27HS5M.ltrans0.ltrans.o: In functionVMGetOwnedMonitorInfo::doit()_ _[clone .local.638]':_ _cc27HS5M.ltrans0.o:(.text+0xcf26): undefined reference to_ _
JvmtiEnvBase::getownedmonitors(JavaThread*, JavaThread*, GrowableArray<_ _jvmtiMonitorStackDepthInfo*>*)' /tmp/cc27HS5M.ltrans0.ltrans.o: In functionVMGetFrameCount::doit()_ _[clone .local.637]':_ _cc27HS5M.ltrans0.o:(.text+0xcf8a): undefined reference to_ _
JvmtiEnvBase::getframecount(JvmtiThreadState*, int*)' /tmp/cc27HS5M.ltrans0.ltrans.o: In functionVMSetFramePop::doit()_ _[clone_ _.local.636]':_ _cc27HS5M.ltrans0.o:(.text+0xcfea): undefined reference to_ _
JvmtiThreadState::countframes()' cc27HS5M.ltrans0.o:(.text+0xd030): undefined reference toJvmtiEnvThreadState::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
- Previous message (by thread): Fwd: cross compile OpenJDK-9+158 minimal variant failed when link libjvm.so
- Next message (by thread): Fwd: cross compile OpenJDK-9+158 minimal variant failed when link libjvm.so
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]