On 11/13/14 07:37, Radovan Obradovic wrote:
A problem is detected with building Linux kernel on MIPS platform when
both -fuse-caller-save and -pg options are present. The reason for this
is that -fuse-caller-save relies on the analysis of RTL code, but when
profiling is active (with -pg option) the code is instrumented
by adding a call to mcount function at the beginning of each function.
And this is realized on the most platforms simply by fprintf function,
so this instrumentation is not reflected in RTL code. The result is
that bad code is produced. A solution could be to disable -fuse-caller-save
when -pg is active.
Presumably we can get the same kinds of problems with ports that don't
emit prologues/epilogues as RTL? I'm particularly concerned about cases
where the prologue or epilogue might use a call-clobbered register as a
scratch that isn't used anywhere else in the function.
ISTM this test out to be expanded to test HAVE_prologue and
HAVE_epilogue as well.
Is there any way you could cobble together a testcase for the problem
you saw with the kernel? It's OK if the test is target specific, though
obviously we get better coverage if it's a target independent test.
Your call on that decision.
Please repost after updating to test HAVE_prologue and HAVE_epilogue and
adding a testcase.
Thanks,
Jeff