RFR: JDK-8313616: support loading library members on AIX in os::dll_load
Matthias Baesken
mbaesken at openjdk.org
Wed Aug 9 14:33:38 UTC 2023
On Wed, 9 Aug 2023 13:33:21 GMT, Martin Doerr <mdoerr at openjdk.org> wrote:
>> AIX dlopen allows loading members of a lib; the syntax for members is libname(member-object) . However this needs an additional flag RTLD_MEMBER passed to dlopen.
>> Example from our OpenJDK codebase : dlopen("/usr/lib/libperfstat.a(shr_64.o)", RTLD_MEMBER | RTLD_NOW);
>>
>> However, currently we do not support this in os::dll_load, so member loading would fail because of the missing RTLD_MEMBER flag.
>> See https://www.ibm.com/docs/en/aix/7.1?topic=d-dlopen-subroutine part about RTLD_MEMBER
>
> src/hotspot/os/aix/os_aix.cpp line 1125:
>
>> 1123: // RTLD_LAZY has currently the same behavior as RTLD_NOW
>> 1124: // The dl is loaded immediately with all its dependants.
>> 1125: int dflags = RTLD_LAZY;
>
> Looks ok. Maybe it would be safer to use `RTLD_NOW` in case the implementation changes at some point of time.
Hi martin, I spoke to our local AIX experts and they said better to use RTLD_LAZY because this is used more across platforms. Additionally it is very unlikely that in the near future, on AIX, RTLD_LAZY and RTLD_NOW would differ.
> src/hotspot/os/aix/os_aix.cpp line 1130:
>
>> 1128: int flen = strlen(filename);
>> 1129: if (flen > 0 && filename[flen - 1] == ')') {
>> 1130: dflags = RTLD_LAZY | RTLD_MEMBER;
>
> Better: `dflags |= RTLD_MEMBER;`
Hi Martin, I adjusted this coding.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15204#discussion_r1288537692
PR Review Comment: https://git.openjdk.org/jdk/pull/15204#discussion_r1288591504
More information about the hotspot-runtime-dev
mailing list