MIPS PATCH: profiling fixes

Sandra Loosemore sandra@codesourcery.com
Sat Sep 8 23:16:00 GMT 2007


This patch fixes some problems relating to profiling on MIPS, 
specifically for the mips*-sde-elf* target.  Without this patch, 
profiling is pretty much completely busted due to lossage of $ra on the 
call to _mcount.  The other two pieces of this patch are necessary for 
-mips16 support.  I ran the gcc testsuite with -pg on after installing 
this patch, and found that it seems to fix everything except for one 
test that bangs on __builtin_return_address.

This patch obviously doesn't address the issue of library or gprof 
support.  MTI's SDE libraries do support a real version of _mcount, but
I tested this in a newlib-based configuration with a dummy definition of 
_mcount added to keep the linker happy, which is sufficient for checking 
that the compiler is generating code that works.

-Sandra


2007-09-07  Sandra Loosemore  <sandra@codesourcery.com>
             Nigel Stephens  <nigel@mips.com>
             David Ung  <davidu@mips.com>

         gcc/
         * config/mips/mips.c (mips_save_reg_p):  Save $ra when profiling
         since it's clobbered by the call to _mcount.
         * config/mips/mips.h (NO_PROFILE_COUNTERS): Define.
         (ASM_OUTPUT_REG_PUSH): Replace {d}subu with {d}addiu and a negative
         immediate such that it works with MIPS16 instructions.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 42-mips-profiling.patch
Type: text/x-patch
Size: 1910 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070908/1cad426f/attachment.bin>


More information about the Gcc-patches mailing list