diff options
author | Yuta Saito <[email protected]> | 2023-12-17 14:21:17 +0000 |
---|---|---|
committer | Yuta Saito <[email protected]> | 2023-12-19 11:13:38 +0900 |
commit | 36b389c206b0d793da45bc73c8a036e1d5c7a72e (patch) | |
tree | fdd3dcd16aa6a80ff3c2a4d7903327d26cc93fdd | |
parent | acfd2e9d6447f82913a8e2241349fb9e29afabde (diff) |
[wasm] dln.c: Guard `dladdr` use in symbol incompatibility check
wasi-libc recently added a family of `dl*` functions[^1], but it still
doesn't have `dladdr` unlike other platforms. Guard the use of `dladdr`
with `HAVE_DLADDR` to avoid build failure with the head version of
wasi-libc.
The library name is used only for diagnostic purpose if it's not NULL,
so it's safe to skip it.
[^1]: https://github.com/WebAssembly/wasi-libc/commit/b85d65528d6e17ae1874c6cc6a6a3ac02e83021a
-rw-r--r-- | dln.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -272,13 +272,15 @@ rb_w32_check_imported(HMODULE ext, HMODULE mine) static bool dln_incompatible_func(void *handle, const char *funcname, void *const fp, const char **libname) { - Dl_info dli; void *ex = dlsym(handle, funcname); if (!ex) return false; if (ex == fp) return false; +# if defined(HAVE_DLADDR) + Dl_info dli; if (dladdr(ex, &dli)) { *libname = dli.dli_fname; } +# endif return true; } |