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.
Dmitry Samersoff
dmitry.samersoff at oracle.com
Tue Jan 21 05:36:24 PST 2014
Staffan,
It might be better to place
#ifdef RTLD_FIRST
return (void*)::dlopen(NULL, RTLD_FIRST);
#else
return (void*)::dlopen(NULL, RTLD_LAZY);
#endif
to os_posix.cpp rather than duplicate code because BSDs besides Apple
use RTLD_LAZY.
-Dmitry
On 2014-01-21 17:13, Staffan Larsen wrote:
> 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
>
--
Dmitry Samersoff
Oracle Java development team, Saint Petersburg, Russia
* I would love to change the world, but they won't give me the sources.
More information about the hotspot-runtime-dev
mailing list