Mercurial > hg > truffle
comparison src/share/tools/hsdis/README @ 720:67a2f5ba5582
6684007: PrintAssembly plugin not available for linux or windows
Reviewed-by: rasbold, jrose, twisti
author | never |
---|---|
date | Wed, 15 Apr 2009 09:53:54 -0700 |
parents | c7c777385a15 |
children | c18cbe5936b8 |
comparison
equal
deleted
inserted
replaced
712:6e33bfd4139b | 720:67a2f5ba5582 |
---|---|
30 If the product mode of your JVM does not accept -XX:+PrintAssembly, | 30 If the product mode of your JVM does not accept -XX:+PrintAssembly, |
31 you do not have a version that is new enough. | 31 you do not have a version that is new enough. |
32 | 32 |
33 * Building | 33 * Building |
34 | 34 |
35 To build this project you need a build of Gnu binutils to link against. | 35 To build this project you a copy of GNU binutils to build against. It |
36 It is known to work with binutils 2.17. | 36 is known to work with binutils 2.17 and binutils 2.19.1. Download a |
37 copy of the software from http://directory.fsf.org/project/binutils or | |
38 one of it's mirrors. Builds targetting windows should use at least | |
39 2.19 and currently requires the use of a cross compiler. | |
37 | 40 |
38 The makefile looks for this build in $BINUTILS, or (if that is not set), | 41 The makefile looks for the sources in build/binutils or you can |
39 in .../binutils-2.17-$LIBARCH, where LIBARCH (as in HotSpot) is one of | 42 specify it's location to the makefile using BINTUILS=path. It will |
40 the jre subdirectory keywords i386, amd64, sparc, sparcv9, etc. | 43 configure binutils and build it first and then build and link the |
44 disasembly adapter. Make all will build the default target for your | |
45 platform. If you platform support both 32 and 64 simultaneously then | |
46 "make both" will build them both at once. "make all64" will | |
47 explicitly build the 64 bit version. By default this will build the | |
48 disassembler library only. If you build demo it will build a demo | |
49 program that attempts to exercise the library. | |
41 | 50 |
42 To build Gnu binutils, first download a copy of the software: | 51 Windows |
43 http://directory.fsf.org/project/binutils/ | |
44 | 52 |
45 Unpack the binutils tarball into an empty directory: | 53 In theory this should be buildable on Windows but getting a working |
46 chdir ../../../../.. | 54 GNU build environment on Windows has proven difficult. MINGW should |
47 tar -xzf - < ../binutils-2.17.tar.gz | 55 be able to do it but at the time of this writing I was unable to get |
48 mv binutils-2.17 binutils-2.17-i386 #or binutils-2.17-sparc | 56 this working. Instead you can use the mingw cross compiler on linux |
49 cd binutils-2.17-i386 | 57 to produce the windows binaries. For 32-bit windows you can install |
58 mingw32 using your package manager and it will be added to your path | |
59 automatically. For 64-bit you need to download the 64 bit mingw from | |
60 http://sourceforge.net/projects/mingw-w64. Grab a copy of the | |
61 complete toolchain and unpack it somewhere. Put the bin directory of | |
62 the toolchain in your path. The mingw installs contain cross compile | |
63 versions of gcc that are named with a prefix to indicate what they are | |
64 targetting and you must tell the Makefile which one to use. This | |
65 should either be i586-mingw32msvc or x86_64-pc-mingw32 depending on | |
66 which on you are targetting and there should be a version of gcc in | |
67 your path named i586-mingw32msvc-gcc or x86_64-pc-mingw32-gcc. Tell | |
68 the makefile what prefix to use to find the mingw tools by using | |
69 MINGW=. For example: | |
50 | 70 |
51 From inside that directory, run configure and make: | 71 make MINGW=i586-mingw32msvc BINTUILS=build/binutils-2.19.1 |
52 ( export CFLAGS='-fPIC' | |
53 ./configure i386-pc-elf ) | |
54 gnumake | |
55 | 72 |
56 (Leave out or change the argument to configure if not on an i386 system.) | 73 will build the Win32 cross compiled version of hsdis based on 2.19.1. |
57 | |
58 Next, untar again into another empty directory for the LP64 version: | |
59 chdir .. | |
60 tar -xzf - < ../binutils-2.17.tar.gz | |
61 mv binutils-2.17 binutils-2.17-amd64 #or binutils-2.17-sparcv9 | |
62 cd binutils-2.17-amd64 | |
63 | |
64 From inside that directory, run configure for LP64 and make: | |
65 ( export ac_cv_c_bigendian=no CFLAGS='-m64 -fPIC' LDFLAGS=-m64 | |
66 ./configure amd64-pc-elf ) | |
67 gnumake | |
68 | |
69 The -fPIC option is needed because the generated code will be | |
70 linked into the hsdid-$LIBARCH.so binary. If you miss the | |
71 option, the JVM will fail to load the disassembler. | |
72 | |
73 You probably want two builds, one for 32 and one for 64 bits. | |
74 To build the 64-bit variation of a platforn, add LP64=1 to | |
75 the make command line for hsdis. | |
76 | |
77 So, go back to the hsdis project and build: | |
78 chdir .../hsdis | |
79 gnumake | |
80 gnumake LP64=1 | |
81 | 74 |
82 * Installing | 75 * Installing |
83 | 76 |
84 Products are named like bin/$OS/hsdis-$LIBARCH.so. | 77 Products are named like build/$OS-$LIBARCH/hsdis-$LIBARCH.so. You can |
85 You can install them on your LD_LIBRARY_PATH, | 78 install them on your LD_LIBRARY_PATH, or inside of your JRE next to |
86 or inside of your JRE next to $LIBARCH/libjvm.so. | 79 $LIBARCH/libjvm.so. |
87 | 80 |
88 Now test: | 81 Now test: |
89 export LD_LIBRARY_PATH .../hsdis/bin/solaris:$LD_LIBRARY_PATH | 82 |
83 export LD_LIBRARY_PATH .../hsdis/build/$OS-$LIBARCH:$LD_LIBRARY_PATH | |
90 dargs='-XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly' | 84 dargs='-XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly' |
91 dargs=$dargs' -XX:PrintAssemblyOptions=hsdis-print-bytes' | 85 dargs=$dargs' -XX:PrintAssemblyOptions=hsdis-print-bytes' |
92 java $dargs -Xbatch CompileCommand=print,*String.hashCode HelloWorld | 86 java $dargs -Xbatch CompileCommand=print,*String.hashCode HelloWorld |
93 | 87 |
94 If the product mode of the JVM does not accept -XX:+PrintAssembly, | 88 If the product mode of the JVM does not accept -XX:+PrintAssembly, |