I tried to count the number of instructions for an application that only prints out "Hello, World!" with the given instruction counting tool. (which is located at ./pin/source/tools/ManualExamples/inscount)
And I wondered if there is any difference between static linking and dynamic linking.
So I compiled in the following manners.
g++ -o hello_dynamic hello.cc
g++ -o hello_static hello.cc -static.
When I instrumented them, I've noticed that statically compiled executable and dynamically compiled executable shows quite different results.
Dynamically compiled file's instruction counts: 2060434
Statically compiled file's instruction counts: 82239
The dynamically compiled file shows roughly 25 times many instructions.
I might think no matter how they are compiled, they need to execute the same number of instructions.
I wonder what makes the results so different between them.
It would be appreciated if anyone could help me find out the reason.
Thanks,