How to build hsdis-amd64.dll and hsdis-i386.dll on Windows

  1. Install Cygwin. At the Select Packages screen, add the following packages (by expanding the Devel category, then clicking once on the Skip label next to each package name):
    • gcc-core
    • make
    • mingw64-i686-gcc-core (only needed for hsdis-i386.dll)
    • mingw64-x86_64-gcc-core (only needed for hsdis-amd64.dll)
    • patch
  2. Run the Cygwin Terminal. This can be done using the Desktop or Start Menu icon created by the installer, and will create your Cygwin home directory (C:\cygwin\home\username or C:\cygwin64\home\username, by default).
  3. Download GNU binutils 2.30 (the latest version, at the time of writing; newer versions may or may not work) to your Cygwin home directory, and extract it with tar xvf binutils-2.30.tar.xz.
  4. Go to the OpenJDK repositories, navigate to the appropriate repository (which may be something like jdk8u/jdk8u/hotspot or jdk-updates/jdk9u/hotspot), select tags, then the tag corresponding to your installed JRE version (as indicated by java -version), then bz2. Save the file to your Cygwin home directory, and extract it with tar xvf hotspot-hash.tar.bz2.
  5. Download my hsdis patch to your Cygwin home directory.
  6. Change to the hsdis directory with cd hotspot-hash/src/share/tools/hsdis.
  7. Apply the patch with patch < ~/hsdis.diff.
  8. Build hsdis-amd64.dll with make MINGW=x86_64-w64-mingw32 BINUTILS=~/binutils-2.30, and/or hsdis-i386.dll with make MINGW=i686-w64-mingw32 BINUTILS=~/binutils-2.30.

The DLL can now be installed by copying it from build\Linux-amd64 or build\Linux-i586 to your JRE’s bin\server or bin\client directory.

Note that binutils and OpenJDK use incompatible licenses. As I understand it, this means that it is legal to combine them for personal use, but not to distribute the result. Because of this, I cannot provide prebuilt DLLs.

Bonus tip: if you prefer Intel ASM syntax to AT&T, specify -XX:PrintAssemblyOptions=intel alongside any other PrintAssembly options you use.