RFR: 8346433: Cannot use DllMain in hotspot for static builds

Julian Waters jwaters at openjdk.org
Thu Dec 19 08:54:36 UTC 2024


On Thu, 19 Dec 2024 07:58:52 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

> Thinking about this, decorating all DllMain in JDK code with something like `DllMain_<libname>`, then in the static launcher dlsym'ing them and calling them in the typical order they would be called in were the JVM started normally... would that be a solution? This would be simple to maintain.
> 
> Another solution would be global RAII objects - but that only works in C++ and does not offer the fine grained order-of-init control a simple list of called DllMains would give us.

Not sure I follow, why would we need to GetProcAddress/dlsym code that is already inside the executable? I'm assuming that with static linking the entire JDK is reduced to one giant executable that contains the JVM and all the libraries and their initialization code, which means that the initialization code can just be called normally from the launcher without dlsym like shenannigans, which to my knowledge is for dynamic libraries, unless I am misreading something

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

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


More information about the hotspot-runtime-dev mailing list