@@ -1016,7 +1016,7 @@ bool os::dll_address_to_library_name(address addr, char* buf,
1016
1016
return true ;
1017
1017
}
1018
1018
1019
- static void * dll_load_library (const char *filename, char *ebuf, int ebuflen) {
1019
+ static void * dll_load_library (const char *filename, int *eno, char *ebuf, int ebuflen) {
1020
1020
1021
1021
log_info (os)(" attempting shared library load of %s" , filename);
1022
1022
if (ebuf && ebuflen > 0 ) {
@@ -1044,7 +1044,7 @@ static void* dll_load_library(const char *filename, char *ebuf, int ebuflen) {
1044
1044
void * result;
1045
1045
const char * error_report = nullptr ;
1046
1046
JFR_ONLY (NativeLibraryLoadEvent load_event (filename, &result);)
1047
- result = Aix_dlopen (filename, dflags, &error_report);
1047
+ result = Aix_dlopen (filename, dflags, eno, &error_report);
1048
1048
if (result != nullptr ) {
1049
1049
Events::log_dll_message (nullptr , " Loaded shared library %s" , filename);
1050
1050
// Reload dll cache. Don't do this in signal handling.
@@ -1076,12 +1076,13 @@ void *os::dll_load(const char *filename, char *ebuf, int ebuflen) {
1076
1076
const char new_extension[] = " .a" ;
1077
1077
STATIC_ASSERT (sizeof (old_extension) >= sizeof (new_extension));
1078
1078
// First try to load the existing file.
1079
- result = dll_load_library (filename, ebuf, ebuflen);
1079
+ int eno=0 ;
1080
+ result = dll_load_library (filename, &eno, ebuf, ebuflen);
1080
1081
// If the load fails,we try to reload by changing the extension to .a for .so files only.
1081
1082
// Shared object in .so format dont have braces, hence they get removed for archives with members.
1082
- if (result == nullptr && pointer_to_dot != nullptr && strcmp (pointer_to_dot, old_extension) == 0 ) {
1083
+ if (result == nullptr && eno == ENOENT && pointer_to_dot != nullptr && strcmp (pointer_to_dot, old_extension) == 0 ) {
1083
1084
snprintf (pointer_to_dot, sizeof (old_extension), " %s" , new_extension);
1084
- result = dll_load_library (file_path, ebuf, ebuflen);
1085
+ result = dll_load_library (file_path, &eno, ebuf, ebuflen);
1085
1086
}
1086
1087
FREE_C_HEAP_ARRAY (char , file_path);
1087
1088
return result;
0 commit comments