From: Denis Oliver Kropp Subject: Link plugins against main library to allow dynamic loading of libts without RTLD_GLOBAL Signed-off-by: Denis Oliver Kropp --- #20081124: wsa: printf already fixed in upstream. Makefile.in not present in scm. # Makefile.am fix sent upstream. diff -pur tslib-1.0/plugins/Makefile.am tslib-1.0-hacked/plugins/Makefile.am --- tslib-1.0/plugins/Makefile.am 2006-08-24 23:02:54.000000000 +0200 +++ tslib-1.0-hacked/plugins/Makefile.am 2007-12-02 05:45:39.000000000 +0100 @@ -16,7 +16,7 @@ INCLUDES = -I$(top_srcdir)/src #LTVSN = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \ # -release $(LT_RELEASE) LTVSN = -avoid-version -LIBS = +LIBS = $(top_srcdir)/src/libts.la pluginexecdir = $(PLUGIN_DIR) if ENABLE_LINEAR_MODULE diff -pur tslib-1.0/plugins/Makefile.in tslib-1.0-hacked/plugins/Makefile.in --- tslib-1.0/plugins/Makefile.in 2007-08-29 10:42:51.000000000 +0200 +++ tslib-1.0-hacked/plugins/Makefile.in 2007-12-02 05:45:46.000000000 +0100 @@ -219,7 +219,7 @@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_P LDFLAGS = @LDFLAGS@ LIBFLAGS = @LIBFLAGS@ LIBOBJS = @LIBOBJS@ -LIBS = +LIBS = $(top_srcdir)/src/libts.la LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ diff -pur tslib-1.0/src/ts_load_module.c tslib-1.0-hacked/src/ts_load_module.c --- tslib-1.0/src/ts_load_module.c 2006-08-24 23:02:55.000000000 +0200 +++ tslib-1.0-hacked/src/ts_load_module.c 2007-12-02 05:36:24.000000000 +0100 @@ -46,17 +46,21 @@ int __ts_load_module(struct tsdev *ts, c printf ("Loading module %s\n", fn); #endif handle = dlopen(fn, RTLD_NOW); - if (!handle) - return -1; + if (!handle) { + printf("tslib: dlopen(\"%s\") failed: %s\n", fn, dlerror()); + return -1; + } init = dlsym(handle, "mod_init"); if (!init) { + printf("tslib: dlsym(handle, \"mod_init\") failed: %s\n", dlerror()); dlclose(handle); return -1; } info = init(ts, params); if (!info) { + printf("tslib: init() failed!\n"); dlclose(handle); return -1; } @@ -67,6 +71,8 @@ int __ts_load_module(struct tsdev *ts, c ret = __ts_attach_raw(ts, info); } else { ret = __ts_attach(ts, info); + if (ret) + printf("tslib: __ts_attach(ts, info) failed with code %d!\n", ret); } if (ret) { info->ops->fini(info);