This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] MIPS: Add option to pass return address location to _mcount.
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: David Daney <ddaney at caviumnetworks dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 03 Nov 2009 21:26:01 +0000
- Subject: Re: [PATCH] MIPS: Add option to pass return address location to _mcount.
- References: <028867b99ec532b84963a35e7d552becc783cafc.1256135456.git.wuzhangjin@gmail.com> <2f73eae542c47ac5bbb9f7280e6c0271d193e90d.1256135456.git.wuzhangjin@gmail.com> <3f0d3515f74a58f4cfd11e61b62a129fdc21e3a7.1256135456.git.wuzhangjin@gmail.com> <ea8aa927fbd184b54941e4c2ae0be8ea0b4f6b8a.1256135456.git.wuzhangjin@gmail.com> <1256138686.18347.3039.camel@gandalf.stny.rr.com> <1256233679.23653.7.camel@falcon> <4AE0A5BE.8000601@caviumnetworks.com> <87y6n36plp.fsf@firetop.home> <4AE232AD.4050308@caviumnetworks.com> <87my3htau1.fsf@firetop.home> <4AE5F392.5020405@caviumnetworks.com> <87ljiwr0t9.fsf@firetop.home> <4AE9DAB6.4090307@caviumnetworks.com>
David Daney <ddaney@caviumnetworks.com> writes:
> Richard Sandiford wrote:
>> David Daney <ddaney@caviumnetworks.com> writes:
>>> +@option{-mmcount-raaddr} can be used in conjunction with @option{-pg}
>>> +and a specially coded @code{_mcount} function to record function exit
>>
>> Doc conventions require "specially-coded", I think. We should
>> mention the $12 register too, and the treatment of leaf functions.
>> How about:
>>
>> --------------------------
>> Allow (do not allow) @code{_mcount} to modify the calling function's
>> return address. When enabled, this option extends the usual @code{_mcount}
>> interface with a new @var{ra-address} parameter, which has type
>> @code{intptr_t *} and is passed in register @code{$12}. @code{_mcount}
>> can then modify the return address by doing both of the following:
>> @itemize
>> @item
>> Returning the new address in register @code{$31}.
>> @item
>> Storing the new address in @code{*@var{ra-address}},
>> if @var{ra-address} is nonnull.
>> @end @itemize
>>
>> The default is @option{-mno-mcount-ra-address}.
>> --------------------------
>
> Ok. I took a couple of liberties, but used essentially what you suggest.
Yeah, the reworked version looks good, thanks, but I noticed a typo:
> +Emit (do not emit) code that allows @code{_mcount} to modify the
> +colling function's return address. When enabled, this option extends
^^^^^^^
Fixed as follows and applied.
Richard
gcc/
* doc/invoke.texi: Fix typo.
Index: gcc/doc/invoke.texi
===================================================================
--- gcc/doc/invoke.texi 2009-11-03 21:25:03.000000000 +0000
+++ gcc/doc/invoke.texi 2009-11-03 21:25:03.000000000 +0000
@@ -14216,7 +14216,7 @@ assembler and the linker alone without h
@opindex mmcount-ra-address
@opindex mno-mcount-ra-address
Emit (do not emit) code that allows @code{_mcount} to modify the
-colling function's return address. When enabled, this option extends
+calling function's return address. When enabled, this option extends
the usual @code{_mcount} interface with a new @var{ra-address}
parameter, which has type @code{intptr_t *} and is passed in register
@code{$12}. @code{_mcount} can then modify the return address by