Tim wrote:
Thanks! It's indeed a clever way.
Being still curious, I am waiting for some explanation on which happens at which stage.
-pg both inserts calls to profiling library functions at compile time,
and adds the corresponding libraries at link time, possibly also
substituting -pg built libraries for certain run-time libraries.
Certain compilers change run-time libraries to match options such as
-march, so, although those gcc options may affect only compiler
optimization passes, it needn't be that way forever.