This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Nested functions on ARM


> 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.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]