Contributing various small OpenJDK fixes: IKVM

Jerome Haltom jhaltom at alethic.solutions
Fri Jul 19 14:35:20 UTC 2024


Hello. I am the maintainer of the IKVM project (ikvm.org). IKVM is a set of tools and libraries for translating compiled Java byte code to .NET MSIL. Basically, you can run compiled Java code on .NET.
IKVM consists of our own translation logic and runtime stuff. However, to provide the base class library we reuse OpenJDK. So we maintain a weird fork of much of OpenJDK.
We also, now, make use of most of the backend C, C++ and Objective-C code that forms the JNI backend of most of the OpenJDK base classes. For instance, we build libjava, libnet, libnio, and all the others. To do so however, we do not make use of the existing OpenJDK build system. No Makefiles. Instead, we integrate the build of the C code into the same MSBuild process that powers the rest of our build. And we use Clang as the compiler.

We also build about a dozen versions of this C code for each of our own supported platforms: win-x86, win-x64, win-arm64, osx-x64, osx-arm64, linux-x64, linux-arm64, linux-musl-*, etc. Since we have our own build system, and use clang, we aren't constrained by things like Cygwin, MSYS, or various Linux targets. We build everything for every platform from the same build host and process, and the output all gets bundled together into a single distribution. Consequently, we stumble quite a bit onto various issues with OpenJDK and Clang compatibility. Some of the issues are issues with OpenJDK not supporting certain targets: for instance, we had to patch a few things to get musl to work. Or, for instance, various issues where OpenJDK uses MSVC extensions in the Windows code which aren't replicated by Clang effectively (ternary implicit casting comes to mind).
But also, the big one, and the topic of my question here: there are a few places in OpenJDK where the C code includes a Windows SDK header file using a particular case that might work when building on Windows but does not work when building against the Windows SDK on Linux.

As an example: https://github.com/ikvmnet/jdk8u/commit/6f2c45b0f9f63e3ca24cf850121754a060af70d0

I would like to get some of these changes into upstream. Are these the types of changes that might be acceptable to upstream? This seemed like a good place for me to start with this discussion. At the end of the day, they are mostly minor changes fixing various minor compilation issues with Clang. They should however translate to anybody attempting to build OpenJDK itself, using Clang, on !Windows targeting Windows, or targeting odd platforms like musl.

Also, we're pretty much stuck at JDK8 (today), so my fixes would be targeting that.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/discuss/attachments/20240719/17d48dfb/attachment-0001.htm>


More information about the discuss mailing list