RFR: JDK-8274434: move os::get_default_process_handle and os::dll_lookup to os_posix for POSIX platforms

David Holmes dholmes at openjdk.java.net
Fri Oct 1 04:48:39 UTC 2021


On Tue, 28 Sep 2021 11:13:00 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

> Hello, please review this small change.
> The os::get_default_process_handle and os::dll_lookup functions are pretty similar across the POSIX platforms so they can be moved to os_posix.cpp.

I looked into the special case code for Apple and it comes from:

https://bugs.openjdk.java.net/browse/JDK-8031968

To quote from there:

> The problem is that dlopen() works differently on OS X than on Linux/Solaris. We are using dlopen(NULL, RTLD_LAZY) to get a handle for the main program. On OS X, the call should be dlopen(NULL, RTLD_FIRST).
> 
> The consequence of this is that on OS X if an agent defines Agent_OnAttach_L but is not statically linked, the JVM will not find that symbol the first time the agent is loaded (which is as expected), but the second time the same agent is loaded, the symbol will already exists in the process and now the JVM will call it (which is not expected). 

I must admit however that I don't quite follow that description, nor why this behaviour is limited to macOS. The exact scenario and sequence of operations is unclear to me.

David

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

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


More information about the hotspot-runtime-dev mailing list