坏RELOC地址0x0编制在Cygwin上hsdis(Java HotSpot的反汇编器插件)时, [英] bad reloc address 0x0 when compiling hsdis (Java HotSpot disassembler plugin) on cygwin

查看:558
本文介绍了坏RELOC地址0x0编制在Cygwin上hsdis(Java HotSpot的反汇编器插件)时,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图编译JVM需要拆卸JIT编译code中的 hsdis-amd64.dll 库。

I'm trying to compile the hsdis-amd64.dll library that the JVM needs to disassemble JIT compiled code.

我也跟着<一个href=\"http://stackoverflow.com/questions/9341083/how-to-use-xxunlockdiagnosticvmoptions-xxcompilecommand-print-option-with-j\">this接受的答案。


  • 我安装了Cygwin

  • 下载<一个href=\"http://www.java.net/download/openjdk/jdk7u40/promoted/b43/openjdk-7u40-fcs-src-b43-26_aug_2013.zip\"相对=nofollow> openjdk-7u40-fcs-src-b43-26_aug_2013.zip

  • 和下载的binutils-2.24。 tar.gz的

  • 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

但它失败的

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

所以我应用于<提供的补丁href=\"http://stackoverflow.com/questions/9341083/how-to-use-xxunlockdiagnosticvmoptions-xxcompilecommand-print-option-with-j\">this接受的答案并再次尝试。

编译又失败了。

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
^

我跟编译器的建议,并添加的config.h 之前的 errno.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

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

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.

有谁知道如何解决这个问题,或者可以告诉我如何编译hsdis(热点拆装器插件)?

Does anyone knows how to solve this problem or can tell me how to compile the hsdis (HotSpot disassembler plugin)?

推荐答案

有是需要添加链接到的zlib的(请确保您安装包mingw64-x86_64的-zlib的Cygwin中)。

There is need to add linking against zlib (Be sure that you install package mingw64-x86_64-zlib in cygwin).

打开Makefile文件编辑器,找到规则:

Open Makefile in editor, find rule:

$(TARGET): $(SOURCE) $(LIBS) $(LIBRARIES) $(TARGET_DIR)
    $(CC) $(OUTFLAGS) $(CPPFLAGS) $(CFLAGS) $(SOURCE) $(DLDFLAGS) $(LIBRARIES)

添加-static -lz到第二行作出这样的:

Add "-static -lz" to second line to make that:

$(TARGET): $(SOURCE) $(LIBS) $(LIBRARIES) $(TARGET_DIR)
    $(CC) $(OUTFLAGS) $(CPPFLAGS) $(CFLAGS) $(SOURCE) $(DLDFLAGS) $(LIBRARIES) -static -lz

这篇关于坏RELOC地址0x0编制在Cygwin上hsdis(Java HotSpot的反汇编器插件)时,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆