This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Nested functions on ARM
- To: Nick Clifton <nickc at redhat dot com>
- Subject: Re: Nested functions on ARM
- From: Richard Earnshaw <rearnsha at arm dot com>
- Date: Tue, 14 Nov 2000 18:20:06 +0000
- Cc: drepper at redhat dot com, gcc-bugs at gcc dot gnu dot org, Philip dot Blundell at pobox dot com, scottb at netwinder dot org
- Cc: rearnsha at arm dot com
- Organization: ARM Ltd.
- Reply-To: rearnsha at arm dot com
> Hi Richard,
>
> I believe that I have a fix for the nested function problem on the
> ARM. The idea is to make IP the static chain register, and to save
> it onto the stack during stack frame creation, in order to prevent
> its corruption.
>
> The patch below implements this idea, and seems to work. (Certainly
> the test case that Uli posted now compiles and runs. I am currently
> running the gcc testsuite to make sure that it does break anything
> else).
>
> There are two problems with the patch. Firstly it does not handle
> the corruption of the IP register by the PIC code when AOF_ASSEMBLER
> is true. I was unable to decipher what this code was doing (and why
> it is in output_arm_prologue instead of arm_expand_prologue). If it
> is important I could try to add code for this case as well.
>
> The second problem is that the code uses an unallocated stack slot
> (ie a slot below the stack pointer). It is only used for a short
> period of time, but it is vulnerable to corruption by interrupt
> handlers and the like. I do not know if this will be a problem in
> real life.
>
> What do you think - shall I go ahead and apply it ?
I can't really see what gain there is in replacing one buggy
implementation with another.
Let me think about it....
R.