I'm trying to compile the hsdis-amd64.dll
library that the JVM needs to disassemble JIT compiled code.
I followed this accepted answer.
- I installed cygwin
- downloaded openjdk-7u40-fcs-src-b43-26_aug_2013.zip
- and downloaded binutils-2.24.tar.gz
I created a folder structure like this:
+
+- hsdis // unzipped dir hotspot/src/share/tools/hsdis of openjdk zip
+- binutils-2.24 // unzipped binutils-2.24.tar.gz
First I tried to just compile it using:
$ make OS=Linux MINGW=x86_64-w64-mingw32 BINUTILS=../binutils-2.24
but it failed with
/Linux-amd64/opcodes/libopcodes.a build/Linux-amd64/libiberty/libiberty.a
hsdis.c:32:20: fatal error: sysdep.h: No such file or directory
#include <sysdep.h>
^
compilation terminated.
So I applied the patch provided in this accepted answer and tried again.
The compilation failed again
In file included from hsdis.c:34:0:
build/Linux-amd64/bfd/bfd.h:35:2: error: #error config.h must be included before this header
#error config.h must be included before this header
^
I followed the proposal of the compiler and added config.h
just before the errno.h
include.
Then the error is
e -I../binutils-2.24/bfd -Ibuild/Linux-amd64/bfd -DLIBARCH_amd64 -DLIBARCH=\"amd64\" -DLIB_EXT=\".dll\" -O hsdis.c -shared build/Linux-amd64/bfd/libbfd.a build/Linux-amd64/opcodes/libopcodes.a build/Linux-amd64/libiberty/libiberty.a
build/Linux-amd64/bfd/libbfd.a(compress.o):compress.c:(.text+0x15): undefined reference to `compressBound'
build/Linux-amd64/bfd/libbfd.a(compress.o):compress.c:(.text+0x48): undefined reference to `compress'
build/Linux-amd64/bfd/libbfd.a(compress.o):compress.c:(.text+0x28a): undefined reference to `inflateInit_'
build/Linux-amd64/bfd/libbfd.a(compress.o):compress.c:(.text+0x2c7): undefined reference to `inflate'
build/Linux-amd64/bfd/libbfd.a(compress.o):compress.c:(.text+0x2d6): undefined reference to `inflateReset'
build/Linux-amd64/bfd/libbfd.a(compress.o):compress.c:(.text+0x2f1): undefined reference to `inflateEnd'
/usr/lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/bin/ld: build/Linux-amd64/bfd/libbfd.a(compress.o): bad reloc address 0x0 in section `.pdata'
collect2: error: ld returned 1 exit status
I know that it is a linker problem. For me it seems that it is trying to link against a wrong version, but I might be wrong.
Does anyone knows how to solve this problem or can tell me how to compile the hsdis (HotSpot disassembler plugin)?