Disable calling convention optimization for local functions
Fri Nov 10 18:21:00 GMT 2017
I am using GCC 4.6.3 for i386.
I see that -O2 level optimizes the calling convention (can make it pretty
much arbitrary) for local static functions that are not visible outside the
compilation unit. For various reasons, I would like to disable this, and
enforce C calling convention for all functions including static functions
local to just one source file. What option (some -fno-XXX, say?) should I
specify to achieve my objective?
I do not want to get rid of -O2 altogether. And I do not want to make my
static functions extern.
Note, I tried specifying __attribute__((cdecl)) for the local static
function (whose calling convention I wish to prevent from getting
optimized), but the optimization still happens.
More information about the Gcc-help