tech-pkg archive

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

broken shared C++ libraries with pkgsrc libtool



The new pkgsrc libtool creates C++ libraries with an unresolved
reference to "__dso_handle" (with destructors of static objects).
This is wrong, but I'm not sure whether only libtool is to blame
or whether our toolchain's use of the startup files contributes
as well. (It seems to be linked to the use of cxa_atexit.)

The problem is that libtool now uses "--nostdlib" when shared
libraries are built. Here is an illustration that this just
doesn't work:

$ cat mist.cpp
class mist
{
public:
~mist() { }
};
static mist mist;
$ c++ -fPIC -c mist.cpp
$ c++ -shared -o libmist.so mist.o
$ nm libmist.so |grep dso
000016d0 d __dso_handle
$ c++ -shared -nostdlib -o libmist.so mist.o
$ nm libmist.so |grep dso
         U __dso_handle

So is building shared libs with --nostdlib supposed to work
in general?

best regards
Matthias



------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzende des Aufsichtsrats: MinDir'in Baerbel Brumme-Bothe
Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
Dr. Ulrich Krafft (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
Prof. Dr. Sebastian M. Schmidt
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------


Home | Main Index | Thread Index | Old Index