Skip to content

Commit 2d8358c

Browse files
committed
Allow the same handle to contain multiple interfaces
If a single library contains multiple interfaces (e.g. MKL v2022+) we want to track them separately, since we can now add both of them, making use of `suffix_hint` when calling `lbt_forward()`.
1 parent 561fd22 commit 2d8358c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/config.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,10 @@ void record_library_load(const char * libname, void * handle, const char * suffi
7777
free_idx = idx;
7878
break;
7979
}
80-
// If this library has been loaded before, all we do is copy the `forwards` over
81-
if (lbt_config.loaded_libs[idx]->handle == handle) {
80+
// If this library has been loaded before, and the interface matches, all we do is copy the `forwards` over
81+
// We check interface matching because it is possible for a single library to contain both LP64 and ILP64
82+
// symbols, and we want to treat both of those as separate.
83+
if (lbt_config.loaded_libs[idx]->handle == handle && lbt_config.loaded_libs[idx]->interface == interface) {
8284
memcpy(lbt_config.loaded_libs[idx]->active_forwards, forwards, sizeof(uint8_t)*(NUM_EXPORTED_FUNCS/8 + 1));
8385
clear_other_forwards(idx, forwards, interface);
8486
return;

0 commit comments

Comments
 (0)