Package: g++-4.0 Version: 4.0.0-1 Severity: important shared libs which are built with -fvisibility=hidden likes to segfault as the linker don't find the correct symbols for the __gnu_cxx::mt_allocator internal. Attached are two source files which produces such a segfaulting shared lib. The same code without the visibility switch works fine. Bastian -- Is truth not truth for all? -- Natira, "For the World is Hollow and I have Touched the Sky", stardate 5476.4.
CXX = g++-4.0
TARGETS = libtest.so test
LD_LIBRARY_PATH = .
export LD_LIBRARY_PATH
CXXFLAGS = -Wall -W -Werror -ggdb
CXXFLAGS += -fvisibility=hidden
test-so.o: CXXFLAGS += -fPIC
all: $(TARGETS)
clean:
rm -f $(TARGETS) *.o
run: test
./test
gdb: test
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/lib/debug gdb ./test
libtest.so: test-so.o
$(CXX) -shared -o $@ $^
test: libtest.so test.o
$(CXX) -o test -o $@ $^
#include <list>
__attribute__((visibility("default"))) std::list<int> test ()
{
std::list<int> ret;
ret.push_back (2);
return ret;
}
#include <list>
std::list<int> test ();
int main ()
{
test ();
}
Attachment:
signature.asc
Description: Digital signature