bug-libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: libltdl on AIX


From: Peter O'Gorman
Subject: Re: libltdl on AIX
Date: Tue, 02 Sep 2008 00:05:33 -0500
User-agent: Thunderbird 2.0.0.14 (X11/20080501)

Peter O'Gorman wrote:
> Tom Epperly wrote:
>> We just upgraded to a more recent version of libltdl on my project, and
>> the behavior for AIX seems to have changed. In the past, it seems to
>> have ignored the results of the LTDL_DLOPEN_SELF_WORKS
>> (AC_LIBTOOL_DLOPEN_SELF) test, and now when the test fails it forces a
>> lt_dlopen(NULL, ...) to fail.
>>
>> In libtool-2.2.4/libltdl/loaders/dlopen.c, the following lines appear:
>>
>>   /* On AIX, dlopen(NULL) succeeds but dlsym of symbols fails.
>>      In this case, fail here to let the preopen loader do the job. */
>> #ifndef LTDL_DLOPEN_SELF_WORKS
>>   if (!filename)
>>     module = NULL;
>>   else
>> #endif
>>     module = dlopen (filename, module_flags);
>>
>> The comment in the code fragment above isn't completely correct.
>> dlopen(NULL) works just fine on AIX provided you use -Wl,-bexpall when
>> you link your executable. The configure macro that checks whether
>> dlopen(NULL) works doesn't use -Wl,-bexpall, so the test fails. Ideally,
>> the configure check would add -Wl,-bexpall when testing when
>> dlopen(NULL) works on AIX.
>>
>> In past versions of libtool, the results from the test didn't matter
>> because it seems that libltdl went ahead and called dlopen(NULL) even if
>> configure didn't think it would work.  It would be better for us if
>> libltdl had the old behavior or if the configure script tried
>> -Wl,-bexpall because declaring that dlopen self doesn't work.
> 
> Looks like the relevant thread is here:
> 
> http://lists.gnu.org/archive/html/bug-libtool/2008-01/msg00021.html
> 
> I will probably simply revert that change when I get the chance. Real
> life failures being worse than test suite failures :)


Thanks again for the report. I am pushing this. I am pretty sure that
there is a patch from Albert somewhere that does the right thing
(exports all symbols from the executable including those that begin with
an underscore), but I did not have time to look for it and forward port
it. I hope to find some time later in the week. In the meantime, this is
an improvement, the mdemo tests pass on aix5.3 with this patch.

Peter
-- 
Peter O'Gorman
http://pogma.com
>From c03119b61fbe36256e7eb546dfd6d0ad8eaeb2e1 Mon Sep 17 00:00:00 2001
From: Peter O'Gorman <address@hidden>
Date: Mon, 1 Sep 2008 23:58:40 -0500
Subject: [PATCH] Revert 75142db4f8afc65ba7aae0ed80ea0b35bd9cc382 (AIX libltdl 
dlopen(NULL)

libltdl/m4/ltdl.m4: Remove LTDL_DLOPEN_SELF_WORKS define.
libltdl/loaders/dlopen.c: Remove LTDL_DLOPEN_SELF_WORKS check.
libltdl/m4/libtool.m4 [aix]: Set export_dynamic_flag_spec to -Wl,-bexpall. This 
is a temporary workaround until a real fix is implemented.
---
 ChangeLog                |   12 ++++++++++++
 NEWS                     |    3 +++
 libltdl/loaders/dlopen.c |    9 +--------
 libltdl/m4/libtool.m4    |    2 ++
 libltdl/m4/ltdl.m4       |    6 ------
 5 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9a67fd5..af1f78b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2008-09-01  Peter O'Gorman  <address@hidden>
+
+       Revert 75142db4f8afc65ba7aae0ed80ea0b35bd9cc382 (AIX libltdl
+       dlopen(NULL)
+
+       libltdl/m4/ltdl.m4: Remove LTDL_DLOPEN_SELF_WORKS define.
+       libltdl/loaders/dlopen.c: Remove LTDL_DLOPEN_SELF_WORKS check.
+       libltdl/m4/libtool.m4 [aix]: Set export_dynamic_flag_spec to
+       -Wl,-bexpall. This is a temporary workaround until a real fix
+       is implemented.
+       NEWS: document it.
+
 2008-08-26  Peter O'Gorman  <address@hidden>
 
        Allow for extensions other than .a for preloaded modules.
diff --git a/NEWS b/NEWS
index c85f741..862e2a5 100644
--- a/NEWS
+++ b/NEWS
@@ -24,6 +24,9 @@ New in 2.2.??: 2008-08-??: git version 2.2.5a, Libtool team:
   - Fix 2.2 regression that caused argz symbols to be exported from
     libltdl unrenamed on systems that do not have working argz.
 
+  - Revert "lt_dlopen(NULL) works on AIX again.". It was not the
+    correct fix.
+
 New in 2.2.4: 2008-05-04: git version 2.2.3a, Libtool team:
 
 * New features:
diff --git a/libltdl/loaders/dlopen.c b/libltdl/loaders/dlopen.c
index b445407..1d052b4 100644
--- a/libltdl/loaders/dlopen.c
+++ b/libltdl/loaders/dlopen.c
@@ -191,14 +191,7 @@ vm_open (lt_user_data LT__UNUSED loader_data, const char 
*filename,
 #endif
     }
 
-  /* On AIX, dlopen(NULL) succeeds but dlsym of symbols fails.
-     In this case, fail here to let the preopen loader do the job. */
-#ifndef LTDL_DLOPEN_SELF_WORKS
-  if (!filename)
-    module = NULL;
-  else
-#endif
-    module = dlopen (filename, module_flags);
+  module = dlopen (filename, module_flags);
 
   if (!module)
     {
diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
index fb5f178..39ba996 100644
--- a/libltdl/m4/libtool.m4
+++ b/libltdl/m4/libtool.m4
@@ -4618,6 +4618,7 @@ _LT_EOF
        fi
       fi
 
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
       # It seems that -bexpall does not export symbols beginning with
       # underscore (_), so it is better to generate a list of symbols to 
export.
       _LT_TAGVAR(always_export_symbols, $1)=yes
@@ -5561,6 +5562,7 @@ if test "$_lt_caught_CXX_error" != yes; then
           fi
         fi
 
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
         # It seems that -bexpall does not export symbols beginning with
         # underscore (_), so it is better to generate a list of symbols to
        # export.
diff --git a/libltdl/m4/ltdl.m4 b/libltdl/m4/ltdl.m4
index bac721e..f84f15f 100644
--- a/libltdl/m4/ltdl.m4
+++ b/libltdl/m4/ltdl.m4
@@ -380,12 +380,6 @@ m4_require([_LT_HEADER_DLFCN])dnl
 m4_require([_LT_CHECK_DLPREOPEN])dnl
 m4_require([_LT_DECL_SED])dnl
 
-# lt_cv_dlopen_self gets defined by LT_SYS_DLOPEN_SELF, called by LT_INIT
-if test "$lt_cv_dlopen_self" = yes; then
-  AC_DEFINE([LTDL_DLOPEN_SELF_WORKS], [1],
-    [Define if dlopen(NULL) is able to resolve symbols from the main program.])
-fi
-
 dnl Don't require this, or it will be expanded earlier than the code
 dnl that sets the variables it relies on:
 _LT_ENABLE_INSTALL
-- 
1.5.4.1


reply via email to

[Prev in Thread] Current Thread [Next in Thread]