I know the linkage order in gcc is important for symbols to be correctly determined; but now I am seeing a weird speed issue on the resulting executable. I am linking objects and archieves as
g++ -m32 a.o b.o ar1.a ar2.a -lm -lpthread -lcrypt -lz -pthread -o afast.out
vs
g++ -m32 a.o ar1.a b.o ar2.a -lm -lpthread -lcrypt -lz -pthread -o aslow.out
The second version runs 2x slower. b.o is actually in the ar1.a archieve, but ar2.o has references to it, thus linker complains, thus I had to put the b.o. In the beginning, I was putting b.o all the way to the end of the linkage to make the correct dependency order, though then figured out it even works at beginning, and even faster.
Has anyone experienced this? Is object file linkage order different than archieve order? How can there be any speed impact?
getting similar results with gcc3.4.6 or gcc4.1.2