RFR: JDK-8274434: move os::get_default_process_handle and os::dll_lookup to os_posix for POSIX platforms
lucy at openjdk.java.net
Fri Oct 1 11:57:36 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.
Marked as reviewed by lucy (Reviewer).
OK, it's not that simple to explain. Let me therefore start with the simple statement I got from the knowledgeable contact:
_**The PR is correct. All necessary information can be found in the man page.**_
So I read the man pages (MacOS and Linux).
RTLD_FIRST does only exist on MacOS. It's purpose is to limit symbol search by dlsym(). Symbols in the image are only resolved if dlsym() is called with the image's handle. If the handle was returned by a dlopen(NULL, RTLD_FIRST) call, only the main executable will be searched by dlsym() calls using that handle.
The above behaviour has to be combined with distinct defaults for RTLD_GLOBAL (default on MacOS) and RTLD_LOCAL (default n Linux).
In effect, what we get in both cases is a handle which is tagged such that only the associated image is searched by dlsym() calls.
I hope that helps a bit. I will approve the pull request now.
More information about the hotspot-runtime-dev