I found out that if I put these into a .pc file in this order: -L<directory> ... <list of regular shared libs> -Wl,--whole-archive <list of static libs linked as whole archive> -Wl,--no-whole-archive then pkg-config completely messes up the output, so the result doesn't mean the same to GCC. The output is: -Wl,--whole-archive -Wl,--no-whole-archive -L<directory> ... <list of shared and static libs together> The result of linking using these options will be different. As an example, xulrunner needs "-Wl,--whole-archive -lmozglue -lmemory -Wl,--no-whole-archive" as is, otherwise calling NS_InitXPCOM2() ends in a segmentation fault.
Created attachment 69468 [details] [review] Patch against 0.27.1 to implement whole-archive library handling
Created attachment 69469 [details] [review] Patch against current GIT to implement whole-archive library handling
Thanks a lot for the patch. Unfortunately, I don't think this path can be taken because it would require pkg-config to have special case handling for every linker or compiler flags that's not -l/-L/-I. I think this has to be treated more generally, and I plan to attach something soon in our existing bug19950. *** This bug has been marked as a duplicate of bug 19950 ***
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.