On Tue, 19 Oct 2021 04:47:52 GMT, Nick Gasson <ngas...@openjdk.org> wrote:
>> This patch expands the newly added system for hsdis backends to include LLVM. >> >> The actual code in hsdis-llvm.cpp is based heavily on the work by @luhenry, >> as published in the never integrated PR >> https://github.com/openjdk/jdk/pull/392. (I have basically just ripped out >> the binutils-based part of it.) >> >> Unfortunately I have not been able to make this work properly on Windows. >> With some additional flags I made it compile without complaints, but it >> caused hotspot to segfault in `LoadLibrary` (!) in `os::dll_load` when I >> tried to load the library. This is somewhat ironic, since the initial >> implementation was created by Ludovic for the very purpose of using it on >> Windows. >> >> The lack of Windows support in this patch does not mean it is impossible to >> get it to work, just that I need to co-operate with someone who has more >> experience of compiling LLVM on Windows, and/or are more eager to get this >> combination to work. > > Rather than introduce a new dependency on all of LLVM you might like to take > a look at Capstone - https://www.capstone-engine.org/ . AFAIK the > disassemblers are generated from the same LLVM architecture description files > so the instruction coverage should be the same but the library is much more > lightweight. It's packaged in most Linux distributions and there's pre-built > Windows binaries available. @nick-arm That'd introduce a new dependency to Capstone. ;-) But your suggestion is excellent -- in fact, I have a branch in my personal fork that builds hsdis with Capstone as backend. I just scheduled for myself to submit this PR first. (Which maybe was a mistake; it was obviously more tricky to get right than I anticipated.) I might reconsider that choice and let this PR wait until I've pushed the Capstone backend first, instead. ------------- PR: https://git.openjdk.java.net/jdk/pull/5920