RFR: 8253757: Add LLVM-based backend for hsdis

Saint Wesonga duke at openjdk.java.net
Tue Jan 11 17:51:32 UTC 2022


On Wed, 17 Nov 2021 13:17:21 GMT, Magnus Ihse Bursie <ihse at 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.
>
> Yeah bot, I'm still working on it.

@magicus @JornVernee Thank you for starting this PR and for the notes on the Windows changes. I'm trying them out on macOS and Windows.

@theRealAph I'm not as familiar with the mac platform. Did you need to do anything special to address these errors? I was adding -L/opt/homebrew/opt/llvm/lib to the HSDIS_LDFLAGS.

```Undefined symbols for architecture arm64:
  "_LLVMCreateDisasm", referenced from:
      hsdis_backend::hsdis_backend(unsigned long, unsigned long, unsigned char*, unsigned long, void* (*)(void*, char const*, void*), void*, int (*)(void*, char const*, ...), void*, char const*, int) in hsdis-llvm.o
  "_LLVMDisasmDispose", referenced from:
      hsdis_backend::~hsdis_backend() in hsdis-llvm.o
...
ld: symbol(s) not found for architecture arm64
clang-13: error: linker command failed with exit code 1 (use -v to see invocation)

-------------

PR: https://git.openjdk.java.net/jdk/pull/5920


More information about the hotspot-compiler-dev mailing list