Skip to content

Commit

Permalink
Merge pull request #157 from LLNL/develop
Browse files Browse the repository at this point in the history
Release 0.0.7-patch3
  • Loading branch information
hariharan-devarajan authored Jun 17, 2024
2 parents 75f9ec6 + 5726d79 commit ae053b7
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/gotcha_dl.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,16 @@ static void *dlsym_wrapper(void *handle, const char *symbol_name) {
int result = lookup_hashtable(&function_hash_table, (hash_key_t)symbol_name,
(hash_data_t *)&binding);
void *val = orig_dlsym(handle, symbol_name);
void **wrappee_ptr = getInternalBindingAddressPointer(
(struct internal_binding_t **)binding->user_binding->function_handle);
if (result != -1 && (val == NULL || *wrappee_ptr == val)) {
// if the wrapper is found and the wrappee is the function requested.
// This is needed in cases where we wrap a function F1 from library A and
// we dynamically load function F1 from library B. As name is same, we need
// to make sure the wrappee are the same as well
return binding->user_binding->wrapper_pointer;
if (result != -1) {
void **wrappee_ptr = getInternalBindingAddressPointer(
(struct internal_binding_t **)binding->user_binding->function_handle);
if (val == NULL || *wrappee_ptr == val) {
// if the wrapper is found and the wrappee is the function requested.
// This is needed in cases where we wrap a function F1 from library A and
// we dynamically load function F1 from library B. As name is same, we
// need to make sure the wrappee are the same as well
return binding->user_binding->wrapper_pointer;
}
}
if (handle == RTLD_NEXT) {
struct link_map *lib = gotchas_dlsym_rtld_next_lookup(
Expand Down

0 comments on commit ae053b7

Please sign in to comment.