I found out that if I put these into a .pc file in this order:
<list of regular shared libs>
<list of static libs linked as whole archive>
then pkg-config completely messes up the output, so the result doesn't mean the same to GCC.
The output is:
<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.