On Mon, 18 Mar 2024 17:24:05 GMT, Jaikiran Pai <[email protected]> wrote:
>> Suchismith Roy has updated the pull request incrementally with seven
>> additional commits since the last revision:
>>
>> - remove space
>> - remove debug print lines
>> - remove debug print lines
>> - remove debug lines
>> - variable name check
>> - code cleanup
>> - made changes to file loading procedure
>
> src/java.base/share/classes/jdk/internal/loader/NativeLibraries.java line 130:
>
>> 128: //Remove member name in brackets from
>> file pathname, as such pathnames do not exist.
>> 129: //Original pathname with bracket is
>> returned,which is handled by dlopen() in AIX.
>> 130: if (file.getName().contains("(")){
>
> Hello @suchismith1993, can you provide us some context on what this check is
> about? Is some code application code calling `System.load("foo(bar");` and
> this code in then trying to remove that `(`?
>
> Adding this code here wouldn't be right. Plus, I see that in this new `if`
> block, the code then goes and renames the underlying `File` to a new name,
> which too isn't right.
>
> Knowing the context of why this is needed would help us understand if
> anything needs to change here.
In AIX, we have an usecase where shared libraries have certain member objects
to be referred to.
E.g libclang.a(shr_64.o) .
When we provide the path to loadLibrary(), it searches if the file exists as
absolute path .i.e libclang.a(shr_64.o), but such a path doesn't exist, only
dlopen() would be able to recognise the member object mentioned in the path and
able to load it.
So before the code transitions to native code where dlopen() happens, the
member object is being removed from the filename,so that the right path is
referred(libclang.a) , and then the original path name with member name is
passed on to the dlopen()
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17945#discussion_r1528982168