summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary V. Vaughan <gary@gnu.org>2014-11-20 21:50:48 +0000
committerGary V. Vaughan <gary@gnu.org>2014-11-20 22:16:31 +0000
commit1117977cc5c466546f155bacb82e9dd9a2f5b049 (patch)
treea5cd87db1d0fb01b859f38a06b6be8faf7781c70
parent1d887c9b5002d8e9a4e65c192c8a1b7355cc356a (diff)
downloadm4-1117977cc5c466546f155bacb82e9dd9a2f5b049.tar.gz
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 <gary@gnu.org>
-rw-r--r--configure.ac2
-rw-r--r--m4/module.c15
2 files changed, 16 insertions, 1 deletions
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 *);