RFR(S): 8031968 : Mac OS X: VM starts the agent by calling both Agent_OnAttach and Agent_OnAttach_L functions if its agent library is dynamically linked.

Staffan Larsen staffan.larsen at oracle.com
Tue Jan 21 05:13:02 PST 2014


Please review the following fix for how statically linked JVMTI libraries are initialized.

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).

webrev: http://cr.openjdk.java.net/~sla/8031968/webrev.00/
bug: https://bugs.openjdk.java.net/browse/JDK-8031968

Thanks,
/Staffan


More information about the hotspot-runtime-dev mailing list