-
Dan Williams authored
gcc's linker does not add constructors from object files to the main executable if they are built into a convenience library and then the library is linked to the executable, unless something outside of the object file with the constructor references a symbol from the object file. http://osdir.com/ml/libtool-gnu/2011-06/msg00003.html "Yes, when convenience libraries are used to create a shared library, all the objects are included in the output, when the output is an application they are used like a normal archive library. Either use them to create a shared library or, if creating an application, don't use them, use the objects instead." Further patches will remove all references to the NMDevice subclasses from nm-manager.c, and have each NMDevice subclass register itself with a factory through a constructor. But due to the above issue, we need to somehow ensure the constructor in each nm-device-*.c file gets added to the executable. This is accomplished by explicitly linking each NMDevice subclass' object file into the main executable. (Note that we cannot use -Wl,-whole-archive here because libtool only supports this option for linking a convenience library to a shared library, but not to an executable, and will actively prevent using -whole-archive in LDFLAGS)
38b076de