On Wed, 2 Dec 2009 18:34:06 +0100
Pierre Ossman <oss...@cendio.se> wrote:

> 
> So either libtool needs to start mangling, or libltdl needs to stop.
> I'm voting for the former as symbol names can already contain the
> mangled module name.
> 

Apparently this wasn't a good idea. Some applications look through the
preload list and expect things to be named as they are on disk.

So the only other alternative is to make libltdl stop mangling. I've
attached a patch that does this.

Comments?

-- 
Pierre Ossman            OpenSource-based Thin Client Technology
System Developer         Telephone: +46-13-21 46 00
Cendio AB                Web: http://www.cendio.com
--- libltdl/ltdl.c.orig	2009-12-03 12:55:28.000000000 +0100
+++ libltdl/ltdl.c	2009-12-03 13:03:29.000000000 +0100
@@ -1230,19 +1230,22 @@
       ext = base_name + LT_STRLEN (base_name);
     }
 
-  /* extract the module name from the file name */
+  /* extract the module and archive name from the file name */
   name = MALLOC (char, ext - base_name + 1);
-  if (!name)
+  archive_name = MALLOC (char, ext - base_name + LT_STRLEN (libext) + 2);
+  if (!name || !archive_name)
     {
       ++errors;
       goto cleanup;
     }
 
-  /* canonicalize the module name */
+  /* canonicalize the module name and generate the archive name */
   {
     int i;
     for (i = 0; i < ext - base_name; ++i)
       {
+	archive_name[i] = base_name[i];
+
 	if (isalnum ((unsigned char)(base_name[i])))
 	  {
 	    name[i] = base_name[i];
@@ -1253,6 +1256,10 @@
 	  }
       }
     name[ext - base_name] = LT_EOS_CHAR;
+
+    archive_name[ext - base_name] = '.';
+    archive_name[ext - base_name + 1] = LT_EOS_CHAR;
+    strcat(archive_name, libext);
   }
 
   /* Before trawling through the filesystem in search of a module,
@@ -1263,11 +1270,9 @@
 
       if (vtable)
 	{
-	  /* name + "." + libext + NULL */
-	  archive_name = MALLOC (char, LT_STRLEN (name) + LT_STRLEN (libext) + 2);
 	  *phandle = (lt_dlhandle) lt__zalloc (sizeof (struct lt__handle));
 
-	  if ((*phandle == NULL) || (archive_name == NULL))
+	  if (*phandle == NULL)
 	    {
 	      ++errors;
 	      goto cleanup;
@@ -1276,8 +1281,6 @@
 
 	  /* Preloaded modules are always named according to their old
 	     archive name.  */
-	  sprintf (archive_name, "%s.%s", name, libext);
-
 	  if (tryall_dlopen (&newhandle, archive_name, advise, vtable) == 0)
 	    {
 	      goto register_handle;

Attachment: signature.asc
Description: PGP signature

Reply via email to