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, cheng...@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.