@@ -1108,7 +1108,7 @@ bool os::dll_address_to_library_name(address addr, char* buf,
11081108 return true ;
11091109}
11101110
1111- static void * dll_load_library (const char *filename, char *ebuf, int ebuflen) {
1111+ static void * dll_load_library (const char *filename, int *eno, char *ebuf, int ebuflen) {
11121112
11131113 log_info (os)(" attempting shared library load of %s" , filename);
11141114 if (ebuf && ebuflen > 0 ) {
@@ -1135,7 +1135,7 @@ static void* dll_load_library(const char *filename, char *ebuf, int ebuflen) {
11351135
11361136 void * result;
11371137 const char * error_report = nullptr ;
1138- result = Aix_dlopen (filename, dflags, &error_report);
1138+ result = Aix_dlopen (filename, dflags, eno, &error_report);
11391139 if (result != nullptr ) {
11401140 Events::log_dll_message (nullptr , " Loaded shared library %s" , filename);
11411141 // Reload dll cache. Don't do this in signal handling.
@@ -1166,12 +1166,13 @@ void *os::dll_load(const char *filename, char *ebuf, int ebuflen) {
11661166 const char new_extension[] = " .a" ;
11671167 STATIC_ASSERT (sizeof (old_extension) >= sizeof (new_extension));
11681168 // First try to load the existing file.
1169- result = dll_load_library (filename, ebuf, ebuflen);
1169+ int eno=0 ;
1170+ result = dll_load_library (filename, &eno, ebuf, ebuflen);
11701171 // If the load fails,we try to reload by changing the extension to .a for .so files only.
11711172 // Shared object in .so format dont have braces, hence they get removed for archives with members.
1172- if (result == nullptr && pointer_to_dot != nullptr && strcmp (pointer_to_dot, old_extension) == 0 ) {
1173+ if (result == nullptr && eno == ENOENT && pointer_to_dot != nullptr && strcmp (pointer_to_dot, old_extension) == 0 ) {
11731174 snprintf (pointer_to_dot, sizeof (old_extension), " %s" , new_extension);
1174- result = dll_load_library (file_path, ebuf, ebuflen);
1175+ result = dll_load_library (file_path, &eno, ebuf, ebuflen);
11751176 }
11761177 FREE_C_HEAP_ARRAY (char , file_path);
11771178 return result;
0 commit comments