Question on location of hsdis library for JDK7
Tom Rodriguez
tom.rodriguez at oracle.com
Tue Jul 5 12:02:00 PDT 2011
This looks like a bug in disassembler.cpp that was masked by how LD_LIBRARY_PATH was setup by older JDKs. The 1.6 launcher always setup the LD_LIBRARY_PATH to point into jre/lib/<arch> and jre/lib/<arch>/<vm> but the 1.7 one doesn't. It relies on $ORIGIN and some extra smarts to avoid having to re-exec to setup LD_LIBRARY_PATH. This is 6367077.
The bug is that when hotspot looks for hsdis next to libjvm.so it's not stripping the lib path of the path so it tries to open libhsdis-i386.so.
/7: open("/net/jre.us.oracle.com/p/v33/jdk/6_14/fcs/b08/binaries/solaris-amd64/fastdebug/jre/lib/i386/client/libhsdis-i386.so", O_RDONLY|O_NONBLOCK) Err#2 ENOENT
It then falls back to an LD_LIBRARY_PATH lookup on hsdis-i386.so which in 1.6 will find it next to libjvm.so or even in jre/lib/<arch> but which will fail in 1.7. I filed 7062856 for this.
For now, you can rename your library to libhdis-<arch>.so.
tom
On Jul 2, 2011, at 5:14 AM, Krystal Mok wrote:
> Hi all,
>
> I used to build the hsdis library and put it along side $LIBARCH/libjvm.so and it worked fine.
>
> But when I was trying it out today with JDK7 build 147 x64 on Ubuntu, putting hsdis-amd64.so along side libjvm.so didn't work.
> The log says:
> Could not load hsdis-amd64.so; library not loadable; PrintAssembly is disabled
>
> Instead, setting LD_LIBRARY_PATH to the where hsdis-amd64.so is in did work like before. e.g.
> $ export LD_LIBRARY_PATH=.:/home/sajia/jdk/7b147_x64_debug/fastdebug/jre/lib/amd64/server
>
> I'm not sure from which version it started to behave like this, or which platforms are affected.
>
> On the same machine, JDK6u25 can load the same hsdis-amd64.so from along side libjvm.so without problem.
> Then I copied libjvm.so from JDK7b147 to my JDK6u25 installation and tried again:
>
> $ echo $LD_LIBRARY_PATH
>
> $ java -Xcomp -XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly | head -n5
> Java HotSpot(TM) 64-Bit Server VM warning: PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output
> VM option '+UnlockDiagnosticVMOptions'
> VM option '+PrintAssembly'
> Loaded disassembler from hsdis-amd64.so
> Decoding compiled method 0x00002aaaab118910:
> $ java -version
> java version "1.6.0_25"
> Java(TM) SE Runtime Environment (build 1.6.0_25-b06)
> Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17-fastdebug, mixed mode)
>
> And it worked. And then doing the reverse, copied the libjvm.so to JDK7b147's installation:
>
> $ export JAVA_HOME=~/jdk/7b147_x64_debug/fastdebug
> $ export PATH=$JAVA_HOME/bin:$PATH
> $ echo $LD_LIBRARY_PATH
>
> $ java -version
> java version "1.7.0-fastdebug"
> Java(TM) SE Runtime Environment (build 1.7.0-fastdebug-b147)
> Java HotSpot(TM) 64-Bit Server VM (build 20.0-b11, mixed mode)
> $ ls $JAVA_HOME/jre/lib/amd64/server/
> hsdis-amd64.so libjsig.so libjvm.so libjvm.so.orig Xusage.txt
> $ java -Xcomp -XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly | head -n5
> Java HotSpot(TM) 64-Bit Server VM warning: PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output
> Could not load hsdis-amd64.so; library not loadable; PrintAssembly is disabled
>
> From that I'd guess it's a JDK7-only behavior; doesn't seem to be a HotSpot VM problem.
> Does anybody have a clue on this?
>
> Regards,
> Kris Mok
More information about the hotspot-dev
mailing list