This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] gcc/config/tilegx/tilegx.c (tilegx_function_profiler): Save r10 to stack before call mcount
- From: Chen Gang <chengang at emindsoft dot com dot cn>
- To: Mike Stump <mikestump at comcast dot net>
- Cc: law at redhat dot com, rth at redhat dot com, gcc-patches at gcc dot gnu dot org, cmetcalf at ezchip dot com, walt at tilera dot com, peter dot maydell at linaro dot org
- Date: Mon, 30 May 2016 22:25:13 +0800
- Subject: Re: [PATCH] gcc/config/tilegx/tilegx.c (tilegx_function_profiler): Save r10 to stack before call mcount
- Authentication-results: sourceware.org; auth=none
- References: <1464518342-31609-1-git-send-email-chengang at emindsoft dot com dot cn> <FCC46458-5296-4B4F-A64C-72934E98EB66 at comcast dot net> <574C40D4 dot 2060301 at emindsoft dot com dot cn>
On 5/30/16 21:32, Chen Gang wrote:
> On 5/30/16 03:18, Mike Stump wrote:
>> On May 29, 2016, at 3:39 AM, chengang@emindsoft.com.cn wrote:
>>>
>>> r10 may also be as parameter for the nested function, so need save it
>>> before call mcount.
>>
>> mcount can have a special abi where it preserves more registers than one would otherwise expect. I'm wondering if you know what registers it saves or doesn't touch? Does this fix any bug found by running tests, or just by inspection?
>>
>
> It is about Bug71331, which I reported yesterday.
>
> For nested function, r10 is treated as the stack pointer for parameters,
> mcount really save r10, but tilegx also use r10 to save lr, so cause
> this issue ("move r10, lr; jal __mcount").
>
> What I have done just like gcc x86 has done ("push r10; callq mcount").
>
After this patch, nested-func-4.c can passes compiling and running under
tilegx qemu. :-)
Thanks.
--
Chen Gang (éå)
Managing Natural Environments is the Duty of Human Beings.