libtool
[Top][All Lists]
Advanced

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

Problems with LTDL_SET_PRELOADED_SYMBOLS


From: John Calcote
Subject: Problems with LTDL_SET_PRELOADED_SYMBOLS
Date: Fri, 13 Mar 2009 12:31:44 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1b3pre) Gecko/20090223 Thunderbird/3.0b2

Hi all,

I'm trying to write a little test program that uses ltdl from Libtool 2.2.6. Now this package comes preinstalled with OpenSuSE 11.1, which is a fairly significant upgrade from OpenSuSE 11.0, which shipped with Libtool 1.5.

Both the older and newer ltdl package are installed on this sytsem - libltdl-3-1.5.26 and libltdl7-2.2.6 but I know I'm linking to the correct library, but I get an undefined symbol error:

$ ls -al /usr/lib64/libltdl*
... /usr/lib64/libltdl.a
... /usr/lib64/libltdl.la
... /usr/lib64/libltdl.so -> libltdl.so.7.2.0
... /usr/lib64/libltdl.so.3 -> libltdl.so.3.1.6
... /usr/lib64/libltdl.so.3.1.6
... /usr/lib64/libltdl.so.7 -> libltdl.so.7.2.0
... /usr/lib64/libltdl.so.7.2.0

$ make
...
libtool: link: gcc -g -O2 -o .libs/jupiter jupiter-main.o  ../libjup/.libs/libjupiter.so /usr/lib64/libltdl.so -ldl -lpthread
jupiter-main.o: In function `main':
/home/jcalcote/dev/prj/autotools/jupiter-libtool-ch7/src/main.c:25: undefined reference to `lt__PROGRAM__LTX_preloaded_symbols'
...

I did a little digging: This line in the ltdl.h header file is causing LTDL_SET_PRELOADED_SYMBOLS to reference the undefined symbol:

#define lt_preloaded_symbols    lt__PROGRAM__LTX_preloaded_symbols
#define LTDL_SET_PRELOADED_SYMBOLS()                    LT_STMT_START{  \
        extern const lt_dlsymlist lt_preloaded_symbols[];               \
        lt_dlpreload_default(lt_preloaded_symbols);                     \
                                                        }LT_STMT_END

Yet, when I use objdump -T on the library, I only see this symbol:

$ objdump -T /usr/lib64/libltdl.so.7.2.0 | grep LTX_pre
0000000000208da0 g    DO .data.rel.ro   0000000000000040  Base        lt_libltdl_LTX_preloaded_symbols

If I add the following definitions to my program:

#if HAVE_LTDL_H
# include <ltdl.h>
# undef lt_preloaded_symbols
# define lt_preloaded_symbols lt_libltdl_LTX_preloaded_symbols
#endif

Then the program links without errors, and runs correctly. It appears that the 2.2.6 header file is out of alignment with the ltdl 2.2.6 library. Is this a defect in libtool 2.2, or a problem with the OpenSuSE 11.1 distro ltdl 2.2.6 package?

One more note on this issue - if I configure with --disable-shared, then my library isn't in my preloaded symbol table anyway - at least I don't see it when walking the list in gdb. So, I'm guessing that my hack was inaccurate, at best. It appears that the 2.2.6 version of libltdl doesn't export the preloaded symbol list.

Thanks in advance,
John


reply via email to

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