Created attachment 34752 [details]
What follows is with gcc-5.0.0-0.10.fc22.x86_64 (Fedora rawhide).
See test case attached, build and run with the provided build.sh script.
- A base class in a shared library (base.h, base.cpp)
- The shared library is linked with -fuse-ld=gold -shared -Wl,--dynamic-list, the contents of the actual list provided to --dynamic-list does not seem to matter (in the provided testcase, the name of the symbol is made up).
- A derived class in an application linking with the library (derived.h, derived.cpp)
- Some random class which uses the derived class
- The assertion at derived.h:25 fails
=> Derived::Derived calls Base::Base passing a DerivedPrivate instance to the base class, then Derived::Derived calls Base::init, which sets Base::self to the instance pointer this and calls DerivedPrivate::foo on the passed DerivedPrivate instance, which tests that Base::self is not null. This incorrectly fails.
This is causing Qt5 applications to crash in various ways.
Does this work without -fuse-ld=gold ?
This is a known gold issue, see:
Unfortunately nothing is being done about it.
Yes, without -fuse-ld=gold it works.
What I forgot to mention: qt worked with gcc 4.9 (and the options passed to the Qt configure script haven't changed). The build log of a qt5-qtbase build built with gcc 4.9 shows that it was also built using the gold linker.
So this really appears to be a gcc 5.0 regression.