libtool-patches
[Top][All Lists]
Advanced

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

libtool 2-0-extern-preloaded_symbols.patch


From: Peter Ekberg
Subject: libtool 2-0-extern-preloaded_symbols.patch
Date: Fri, 22 Jul 2005 10:14:54 +0200

Hi!

In making MSVC work as a C++ compiler a tripped on
a linking bug in libltdl (libltdl was not built as
a DLL since configure disabled shared libs when it
was falsely deduced that the C++ compiler could not
build them).

The problem is as follows. When libltdl is built as a
convenience lib (libltdlc) the LT_SCOPE define is set
to "__declspec(dllexport)" for Win32. In ltdl.c the
variable preloaded_symbols (or maybe I should say
lt_libltdlc_LTX_preloaded_symbols) is tagged with
LT_SCOPE. But the preloaded symbols should not be
exported from ltdl.c, they should be exported from
the generated libltdlcS.c. Anyway, the linker is
confused with these two definitions of
lt_libltdlc_LTX_preloaded_symbols and either selects
the first one it sees or selects the dllexported one.
Whatever algorithm it uses to select which of the
two to use, it of course selects the wrong one in
the libltdlc case. So, the used one is blank (all
zeros) which means that the name member of the first
entry in lt_libltdlc_LTX_preloaded_symbols ends up
being NULL which causes a segfault during lt_dlinit
(libltdl/loaders/preopen.c:322, the call to streq).

To prevent this, I exchanged the offending LT_SCOPE
for a plain extern in ltdl.c, which incidentally
fixes the bug for MinGW as well as for MSVC.


2005-07-21  Peter Ekberg  <address@hidden>

        * libltdl/ltdl.c: The linker is confused by having one
definition
        of lt_libltdlc_LTX_preloaded_symbols tagged with
        __declspec(dllexport) in ltdl.c and one definition with an
initial
        value in libltdlcS.c. So, just say extern in ltdl.c. Fixes the
        mdemo-exec.test for MinGW.

Cheers,
Peter

Attachment: 2-0-extern-preloaded_symbols.patch
Description: 2-0-extern-preloaded_symbols.patch


reply via email to

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