Monday, June 27, 2016

How to build hsdis.dll for Windows 32-bit?

Leave a Comment

I am trying to build hsdis.dll in my laptop 32-bit Windows. I read http://dropzone.nfshost.com/hsdis.htm instructions and got to know that I will have to follow those steps. I saw that I have to use the mingw64-i686-gcc-core. I followed the steps, but have always found this error.

make[2]: i686-w64-mingw32: Command not found Makefile:246: recipe for target 'libiberty.a' failed make[2]: *** [libiberty.a] Error 127 make[2]: Leaving directory '/home/User/hsdis/build/Linux-i586/libiberty' Makefile:8045: recipe for target 'all-libiberty' failed make[1]: *** [all-libiberty] Error 2 make[1]: Leaving directory '/home/User/hsdis/build/Linux-i586' Makefile:192: recipe for target 'build/Linux-i586/bfd/libbfd.a' failed make: *** [build/Linux-i586/bfd/libbfd.a] Error 2 

I would also like to know how to use the directive PrintAssembly, because i wanted to see the assembly code, of a Java class.

I have already saw other posts here, but none of them helped.

Thanks in advance

1 Answers

Answers 1

Here are the steps which help me to build it (x64 version, x86 should be almost the same):

  • download and unpack the latest hsdis sources as described in the building manual from the http://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/tags;
  • download the latest bintuils-2.26.tar.gz package from the http://mirror.tochlab.net/pub/gnu/binutils/;
  • copy it to your Cygwin home directory and unpack it from the Cygwin terminal (this is very important, otherwise you may get permission problems): tar -xzvf ./binutils-2.26.tar.gz
  • install the following Cygwin packages: mingw64-x86_64-gcc-core for x64 or mingw64-i686-gcc-core for x86, diffutils and make;
  • go to hsdis directory;
  • for x64 library build with the command: make OS=Linux MINGW=x86_64-w64-mingw32 'AR=x86_64-w64-mingw32-ar' BINUTILS=~/binutils-2.26 CONFIGURE_ARGS="--host=x86_64-w64-mingw32", for x86 library build with the command: make OS=Linux MINGW=i686-w64-mingw32 'AR=i686-w64-mingw32-ar' BINUTILS=~/binutils-2.26 CONFIGURE_ARGS="--host=i686-w64-mingw32"
  • if you have errors with undefined references to zlib (i.e. build/Linux-amd64/bfd/libbfd.a(compress.o):compress.c:(.text+0x7e): undefined reference to inflate), modify Makefile in hsdis: find the line $(CC) $(OUTFLAGS) $(CPPFLAGS) $(CFLAGS) $(SOURCE) $(DLDFLAGS) $(LIBRARIES) for the $(TARGET) target and append to the end -lz -L$(TARGET_DIR)/zlib, then run the build command again;
  • after that you should find the library hsdis-amd64.dll in hsdis\build\Linux-amd64\ for x64, or hsdis-i386.dll in hsdis\build\Linux-i586\ for x86.
If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment