This is an automated email from the git hooks/post-receive script. tille pushed a commit to branch debian/unstable in repository htslib.
commit ebdb5aa584e8160d105e311619b0a12ac3e5a737 Author: John Marshall <[email protected]> Date: Thu Jul 28 16:54:44 2016 +0100 Allow plugins to select RTLD_LOCAL or RTLD_GLOBAL If the plugin does not provide the requested symbol, fall back to reopening it with RTLD_GLOBAL and searching for a uniquified symbol, <symbol>_<filename_basename>. Most plugins should work with RTLD_LOCAL, but occasionally RTLD_GLOBAL is needed. For example, with iRODS 4.1.x, iRODS itself has plugins (libtcp.so et al) that need to resolve iRODS symbols linked into whatever is invoking it, i.e., HTSlib's hFILE plugin. (cherry picked from commit 344c82579a8d56d1f92c8073c71037b99beb13cb) --- plugin.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/plugin.c b/plugin.c index 7525cc6..aaa965f 100644 --- a/plugin.c +++ b/plugin.c @@ -135,13 +135,35 @@ const char *hts_path_itr_next(struct hts_path_itr *itr) return NULL; } + +#ifndef RTLD_NOLOAD +#define RTLD_NOLOAD 0 +#endif + void *load_plugin(void **pluginp, const char *filename, const char *symbol) { void *lib = dlopen(filename, RTLD_NOW | RTLD_LOCAL); if (lib == NULL) goto error; void *sym = dlsym(lib, symbol); - if (sym == NULL) goto error; + if (sym == NULL) { + // Reopen the plugin with RTLD_GLOBAL and check for uniquified symbol + void *libg = dlopen(filename, RTLD_NOLOAD | RTLD_NOW | RTLD_GLOBAL); + if (libg == NULL) goto error; + dlclose(lib); + lib = libg; + + kstring_t symbolg = { 0, 0, NULL }; + kputs(symbol, &symbolg); + kputc('_', &symbolg); + const char *slash = strrchr(filename, '/'); + const char *basename = slash? slash+1 : filename; + kputsn(basename, strcspn(basename, ".-+"), &symbolg); + + sym = dlsym(lib, symbolg.s); + free(symbolg.s); + if (sym == NULL) goto error; + } *pluginp = lib; return sym; -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/htslib.git _______________________________________________ debian-med-commit mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit
