From 1117977cc5c466546f155bacb82e9dd9a2f5b049 Mon Sep 17 00:00:00 2001 From: "Gary V. Vaughan" Date: Thu, 20 Nov 2014 21:50:48 +0000 Subject: modules: support _ symbol prefix requirement for dlsym. * configure.ac (LT_FUNC_DLSYM_USCORE): Call it to set NEED_USCORE. * m4/module.c (uscore_sym): New function. Use this to prepend an underscore if NEED_USCORE was set at configure time. Reported by KO Myung-Hun Signed-off-by: Gary V. Vaughan --- configure.ac | 2 ++ m4/module.c | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index a219665f..f43a412f 100644 --- a/configure.ac +++ b/configure.ac @@ -204,6 +204,8 @@ AC_MSG_RESULT([$use_modules]) AC_SUBST([DLPREOPEN]) AC_SUBST([PREOPEN_DEPENDENCIES]) +LT_FUNC_DLSYM_USCORE + ## ---------------- ## ## Gettext support. ## diff --git a/m4/module.c b/m4/module.c index 07e33519..8efb1a99 100644 --- a/m4/module.c +++ b/m4/module.c @@ -67,7 +67,20 @@ #define MODULE_SELF_NAME "!myself!" -static const char* module_dlerror (void); +#if NEED_USCORE +static void * +uscore_sym (void *handle, const char *symbol) +{ + char *symname = xasprintf ("_%s", symbol); + void *address = dlsym (handle, symname); + free (symname); + return address; +} + +#define dlsym uscore_sym +#endif + +static const char * module_dlerror (void); static void install_builtin_table (m4*, m4_module *); static void install_macro_table (m4*, m4_module *); -- cgit v1.2.1