Skip to content

Commit

Permalink
Merge branch 'upstream-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Datadog Syncup Service committed May 15, 2024
2 parents 3a9645d + 216b8cb commit 88bc754
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions hotspot/src/os/aix/vm/os_aix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1480,10 +1480,11 @@ static void* dll_load_library(const char *filename, char *ebuf, int ebuflen) {
}
return NULL;
}

// Load library named <filename>
// If filename matches <name>.so, and loading fails, repeat with <name>.a.
void *os::dll_load(const char *filename, char *ebuf, int ebuflen) {
void* result = nullptr;
void* result = NULL;
char* const file_path = strdup(filename);
char* const pointer_to_dot = strrchr(file_path, '.');
const char old_extension[] = ".so";
Expand All @@ -1493,11 +1494,11 @@ void *os::dll_load(const char *filename, char *ebuf, int ebuflen) {
result = dll_load_library(filename, ebuf, ebuflen);
// If the load fails,we try to reload by changing the extension to .a for .so files only.
// Shared object in .so format dont have braces, hence they get removed for archives with members.
if (result == nullptr && pointer_to_dot != nullptr && strcmp(pointer_to_dot, old_extension) == 0) {
if (result == NULL && pointer_to_dot != NULL && strcmp(pointer_to_dot, old_extension) == 0) {
snprintf(pointer_to_dot, sizeof(old_extension), "%s", new_extension);
result = dll_load_library(file_path, ebuf, ebuflen);
}
FREE_C_HEAP_ARRAY(char, file_path);
FREE_C_HEAP_ARRAY(char, file_path, mtInternal);
return result;
}

Expand Down

0 comments on commit 88bc754

Please sign in to comment.