On Fri, 2006-03-24 at 09:12 +0900, Peter O'Gorman wrote:

> Okay, we sometimes get modules that have just the originator name, and
> the end of list. In this case we should fail to open the module.
> 
> Is this okay?
> 
> Peter

Could someone review please. I can drop the dlopen.c change if
necessary.

Peter
Index: ChangeLog
2006-03-24  Peter O'Gorman  <[EMAIL PROTECTED]>

	* libltdl/loaders/preopen.c: Don't allow lt_dlopen if the
	module has no symbols.
	* libltdl/loaders/dlopen.c (get_vtable): Use LT_DLLOADER_APPEND.

from  Ralf Wildenhues  <[EMAIL PROTECTED]>
Index: libltdl/loaders/dlopen.c
===================================================================
RCS file: /sources/libtool/libtool/libltdl/loaders/dlopen.c,v
retrieving revision 1.5
diff -u -r1.5 dlopen.c
--- libltdl/loaders/dlopen.c 22 Apr 2005 10:10:30 -0000 1.5
+++ libltdl/loaders/dlopen.c 24 Mar 2006 00:08:24 -0000
@@ -69,7 +69,7 @@
       vtable->module_close	= vm_close;
       vtable->find_sym		= vm_sym;
       vtable->dlloader_data	= loader_data;
-      vtable->priority		= LT_DLLOADER_PREPEND;
+      vtable->priority		= LT_DLLOADER_APPEND;
     }
 
   if (vtable && (vtable->dlloader_data != loader_data))
Index: libltdl/loaders/preopen.c
===================================================================
RCS file: /sources/libtool/libtool/libltdl/loaders/preopen.c,v
retrieving revision 1.7
diff -u -r1.7 preopen.c
--- libltdl/loaders/preopen.c 22 Apr 2005 10:10:30 -0000 1.7
+++ libltdl/loaders/preopen.c 24 Mar 2006 00:08:24 -0000
@@ -163,8 +163,17 @@
 	{
 	  if (!symbol->address && streq (symbol->name, filename))
 	    {
-	      module = (lt_module) lists->symlist;
-	      goto done;
+	      /* If the next symbol's name and address is 0, it means
+		 the module just contains the originator and no symbols.
+		 In this case we pretend that we never saw the module and
+	         hope that some other loader will be able to load the module
+	         and have access to its symbols */
+	      const lt_dlsymlist *next_symbol = symbol +1;
+	      if (next_symbol->address && next_symbol->name)
+		{
+	          module = (lt_module) lists->symlist;
+	          goto done;
+		}
 	    }
 	}
     }

Reply via email to