RFR: 8346433: Cannot use DllMain in hotspot for static builds [v2]

Magnus Ihse Bursie ihse at openjdk.org
Tue Jan 14 09:53:43 UTC 2025


On Tue, 14 Jan 2025 06:05:35 GMT, David Holmes <dholmes at openjdk.org> wrote:

> If you really wanted/needed it "as early as possible" then a `WINDOWS_ONLY(...)` call at the start of `Threads::create_vm` would be okay too - and that would help with the crash reporting problem.

Actually, I think `JNI_CreateJavaVM_inner` is even earlier; but it still would happen later than the DllMain call, since that is called when the dll is loaded by the system, not when the launcher calls into the VM. This could be "emulated" by a static build by keeping track of what libraries are statically linked and call their respective initialization code extremely early on, but I can't see that anything would require that sort of effort.

I think this is good enough for static builds, and if there ever is a problem with failing to debug static launchers crashing very early, then we can address the issue at that point. Otherwise, I prefer to keep this patch as unobtrusive as possible, and for that I think the current placement is best.

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

PR Comment: https://git.openjdk.org/jdk/pull/22793#issuecomment-2589469050


More information about the hotspot-runtime-dev mailing list