Saturday, March 16, 2013

What is function cloning? Name.clone.XX seen in crash or symbols?


In the case of the gcc compiler, it make a copy of a function with some modifications for faster execution.For example, if the compiler discovers that a function is called many different times with the same couple of initial parameters, then it may clone the function to produce a version which takes fewer parameters, and then change all the invoking functions to call the cloned function named as fn-name.clone instead.

Also found this from another post:
"Another example is that a compiler may make several clones of a function and compile them tuned for different microarchitectures, and then arrange for the appropriate one to be used at runtime based on some sort of CPU test."