Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Build hsdis for JDK 1.8u92 on Ubuntu 17.10 Artful
sudo apt-get install libgmp-dev libmpfr-dev libmpc-dev g++-multilib mercurial texinfo
hg clone http://hg.openjdk.java.net/jdk8u/jdk8u
cd jdk8u
hg update jdk8u92-b14
sed -ri 's/subrepos="[^"]+"/subrepos="hotspot"/' ./make/scripts/hgforest.sh # only get hotspot
sed -ri 's/subrepos="[^"]+"/subrepos="hotspot"/' ./common/bin/hgforest.sh # only get hotspot
chmod +x ./get_source.sh; ./get_source.sh
cd hotspot/src/share/tools/hsdis
wget http://ftp.heanet.ie/mirrors/ftp.gnu.org/gnu/binutils/binutils-2.26.tar.gz
tar -xzf binutils-2.26.tar.gz
sed -ri 's/development=.*/development=false/' ./binutils-2.26/bfd/development.sh # set development to false
make BINUTILS=binutils-2.26 ARCH=amd64
sudo cp build/linux-amd64/hsdis-amd64.so /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server/
@kay

This comment has been minimized.

Copy link

kay commented Sep 23, 2018

This script needs some adjustment

As of recent changes to hotspot (see http://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/rev/bbd1da3f538f) the code was changed to only support binutils-2.29 and later. Thus the only change I had to make to the above script was to use 2.29 and then everything worked fine.

This problem manifests like this during the make step:

hsdis.c: In function ‘setup_app_data’:
hsdis.c:340:32: error: incompatible type for argument 1 of ‘disassembler’
   app_data->dfn = disassembler(bfd_get_arch(native_bfd),
                                ^~~~~~~~~~~~
In file included from hsdis.c:60:0:
/home/kay/src/public/jdk8u/hotspot/src/share/tools/hsdis/binutils-2.26/include/dis-asm.h:341:27: note: expected ‘bfd * {aka struct bfd *}’ but argument is of type ‘enum bfd_architecture’
 extern disassembler_ftype disassembler (bfd *);
                           ^~~~~~~~~~~~
hsdis.c:340:19: error: too many arguments to function ‘disassembler’
   app_data->dfn = disassembler(bfd_get_arch(native_bfd),
                   ^~~~~~~~~~~~
In file included from hsdis.c:60:0:
/home/kay/src/public/jdk8u/hotspot/src/share/tools/hsdis/binutils-2.26/include/dis-asm.h:341:27: note: declared here
 extern disassembler_ftype disassembler (bfd *);
                           ^~~~~~~~~~~~
Makefile:220: recipe for target 'build/linux-amd64/hsdis-amd64.so' failed
make: *** [build/linux-amd64/hsdis-amd64.so] Error 1

This fork has the patched script: https://gist.github.com/kay/ec70aa7469d216ab88eb411d8dab187d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.