preloader declaration bug

2010-03-28 Thread Ralf Wildenhues
Working on support for -flto has uncovered an ugly buglet in libltdl.
ltmain declares this symbol as:

  extern $lt_dlsym_const lt_dlsymlist
  lt_${my_prefix}_LTX_preloaded_symbols[];

but libltdl declares it as:

  #define preloaded_symbols   LT_CONC3(lt_, LTDLOPEN, 
_LTX_preloaded_symbols)

  #ifdef HAVE_LIBDLLOADER
  extern lt_dlsymlist preloaded_symbols;
  #endif

(note the missing []) and takes its address to make up for it.
gcc -flto notices this inconsistency between the objects.

This patch fixes it, it passes the testsuite.  I'll be pushing it soon.
I don't actually know whether this bug can cause issues on some system.

Cheers,
Ralf

Fix preloader symbol list declaration in libltdl.

* libltdl/ltdl.c (preloaded_symbols): Fix declaration to include
array brackets.
(lt_dlinit): Do not take address of preloaded_symbols.

diff --git a/libltdl/ltdl.c b/libltdl/ltdl.c
index 1fe272f..4e1a402 100644
--- a/libltdl/ltdl.c
+++ b/libltdl/ltdl.c
@@ -208,7 +208,7 @@ LT_BEGIN_C_DECLS
 LT_SCOPE const lt_dlvtable *   get_vtable (lt_user_data data);
 LT_END_C_DECLS
 #ifdef HAVE_LIBDLLOADER
-extern lt_dlsymlistpreloaded_symbols;
+extern lt_dlsymlistpreloaded_symbols[];
 #endif
 
 /* Initialize libltdl. */
@@ -234,7 +234,7 @@ lt_dlinit (void)
 #ifdef HAVE_LIBDLLOADER
   if (!errors)
{
- errors += lt_dlpreload (preloaded_symbols);
+ errors += lt_dlpreload (preloaded_symbols);
}
 
   if (!errors)




Re: preloader declaration bug

2010-03-28 Thread Bob Friesenhahn

On Sun, 28 Mar 2010, Ralf Wildenhues wrote:


Working on support for -flto has uncovered an ugly buglet in libltdl.
ltmain declares this symbol as:

 extern $lt_dlsym_const lt_dlsymlist
 lt_${my_prefix}_LTX_preloaded_symbols[];

but libltdl declares it as:

 #define preloaded_symbols   LT_CONC3(lt_, LTDLOPEN, _LTX_preloaded_symbols)

 #ifdef HAVE_LIBDLLOADER
 extern lt_dlsymlist preloaded_symbols;
 #endif

(note the missing []) and takes its address to make up for it.
gcc -flto notices this inconsistency between the objects.

This patch fixes it, it passes the testsuite.  I'll be pushing it soon.
I don't actually know whether this bug can cause issues on some system.


Nice catch.  I had not been aware of the -flto option before.

Bob
--
Bob Friesenhahn
bfrie...@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,http://www.GraphicsMagick.org/