[Development] Problem loading plugins with gcc 4.9.2

Thiago Macieira thiago.macieira at intel.com
Wed Mar 4 01:52:43 CET 2015

On Tuesday 03 March 2015 22:14:55 Sergio Martins wrote:
> In frame #2, we do loader(), which should create an instance of the
> "/platforms"  QFactoryLoader, but instead, it calls innerFunction() of a
> global static of another translation unit (QFactoryLoader of "/accessible"
> plugins).
> A simple fix is to use "loader" instead of "loader()"

Definitely GCC or linker bug.

As you can see in your backtrace, all of this is in an anonymous namespace, so 
qplatformintegrationfactory.cpp cannot affect qaccessible.cpp.

Since we're seeing both operator() and the innerFunction frames, I assume you 
compiled in debug mode. Correct?

Anyway, I have GCC 4.9.2, Binutils 2.25.0 (using gold) and I cannot reproduce 
in either debug, regular release or LTO release modes. I have 8 different 
global statics called "loader" in QtGui:

$ nm -C libQt5Gui.so.5 | grep ::Q_QGS_loader::guard\$
00000000006a5750 b (anonymous namespace)::Q_QGS_loader::guard
00000000006a59c0 b (anonymous namespace)::Q_QGS_loader::guard
00000000006a5a20 b (anonymous namespace)::Q_QGS_loader::guard
00000000006a5ac0 b (anonymous namespace)::Q_QGS_loader::guard
00000000006a5b40 b (anonymous namespace)::Q_QGS_loader::guard
00000000006a61b0 b (anonymous namespace)::Q_QGS_loader::guard
00000000006a6200 b (anonymous namespace)::Q_QGS_loader::guard
00000000006a6374 b (anonymous namespace)::Q_QGS_loader::guard

(The mangled name for all of those is the same: 

Which matches the source code:
$ git --no-pager grep Q_GLOBAL_STATIC.*\\bloader 
accessible/qaccessible.cpp:Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
image/qicon.cpp:Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
image/qimagereader.cpp:Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
image/qimagewriter.cpp:Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,

Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

More information about the Development mailing list