java - 在 cygwin 上编译 hsdis(Java HotSpot 反汇编程序插件)时出现错误的 reloc 地址 0x0

标签 java c compilation cygwin jvm-hotspot

我正在尝试编译 JVM 反汇编 JIT 编译代码所需的 hsdis-amd64.dll 库。

我关注了this接受的答案。

我创建了这样的文件夹结构:

+
+- hsdis             // unzipped dir hotspot/src/share/tools/hsdis of openjdk zip
+- binutils-2.24     // unzipped binutils-2.24.tar.gz

首先我尝试使用以下方法编译它:

$ make OS=Linux MINGW=x86_64-w64-mingw32 BINUTILS=../binutils-2.24

但是失败了

/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.

所以我应用了 this accepted answer 中提供的补丁并再次尝试。

再次编译失败

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
^

我听从了编译器的建议,在 errno.h 包含之前添加了 config.h

那么错误就是

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

我知道这是一个链接器问题。对我来说,它似乎试图链接到错误的版本,但我可能是错的。

有谁知道如何解决这个问题,或者可以告诉我如何编译 hsdis(HotSpot 反汇编程序插件)?

最佳答案

根据 Marat Buharov 的回答,问题可以得到解决。

不过这里有一些链接,您可以在其中找到预编译的 hsdis 插件:

我试过了 http://lafo.ssw.uni-linz.ac.at/hsdis/intel/hsdis-amd64.dll使用 jdk1.7.0_02 并且有效。

关于java - 在 cygwin 上编译 hsdis(Java HotSpot 反汇编程序插件)时出现错误的 reloc 地址 0x0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21042809/

相关文章:

具有泛型和继承的 java 抽象类 : Bound mismatch

c - 当我调用 IDirect3DDevice9::Reset 时会发送哪些消息

java - 无法导入 org.apache.commons

linux - 从没有 "make"且没有 "/usr/src"路径的机器生成 module.symvers

java - 适用于 Android 的巴特沃斯低通滤波器

java - 如何禁用 JList 选择更改事件并仅在双击时调用它?

c - 使用带有 * char 的 strcmp 的段错误

c - 如何将 kmalloc() 地址转换为物理地址

c - PI到底是如何启动这么多进程的

java - 如何在 Eclipse 中禁用消息 "Parameter x is not assigned and could be declared final"?