From 28ad7b337c573c488db66703b3978460bf80c8d6 Mon Sep 17 00:00:00 2001 From: Alastair Poole Date: Sun, 27 May 2018 12:37:18 +0100 Subject: [PATCH] module loading: use global symbols with BSDs and local with Linux. The symbol table fix on Linux doesn't translate well on BSD. Adding code to use the older behaviour with the BSD systems and retaining the new preferred behaviour when using dlopen(3) on Linux. --- src/bin/e_module.c | 4 ++++ src/modules/wizard/e_mod_main.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/bin/e_module.c b/src/bin/e_module.c index 4cda9e0a8..e0ee00f5a 100644 --- a/src/bin/e_module.c +++ b/src/bin/e_module.c @@ -392,7 +392,11 @@ e_module_new(const char *name) m->error = 1; goto init_done; } +#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__OpenBSD__) || defined(__NetBSD__) + m->handle = dlopen(modpath, (RTLD_NOW | RTLD_GLOBAL)); +#else m->handle = dlopen(modpath, (RTLD_NOW | RTLD_LOCAL)); +#endif if (!m->handle) { snprintf(body, sizeof(body), diff --git a/src/modules/wizard/e_mod_main.c b/src/modules/wizard/e_mod_main.c index 69b997a5e..32f491f83 100644 --- a/src/modules/wizard/e_mod_main.c +++ b/src/modules/wizard/e_mod_main.c @@ -71,7 +71,11 @@ e_modapi_init(E_Module *m) else snprintf(buf, sizeof(buf), "%s/%s/%s", e_module_dir_get(m), MODULE_ARCH, file); +#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__OpenBSD__) || defined(__NetBSD__) + handle = dlopen(buf, RTLD_NOW | RTLD_GLOBAL); +#else handle = dlopen(buf, RTLD_NOW | RTLD_LOCAL); +#endif if (handle) e_wizard_page_add(handle, file, dlsym(handle, "wizard_page_init"),