[Bug target/14202] [arm] Thumb __builtin_setjmp not interworking safe

ramana at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Apr 9 11:31:00 GMT 2009



------- Comment #12 from ramana at gcc dot gnu dot org  2009-04-09 11:31 -------

For the record here's some more info on the problem. 

One part of the problem is as described in comment #1 about labels having the
right bit and the correct instruction being generated which I've achieved by a
method inspired by Richard to mark setjmp receiver labels as STT_FUNC.

 The other part of the problem however is that the frame pointer registers for
ARM state and Thumb state are different. Hence if you did a setjmp from an ARM
state function and you did a longjmp from a Thumb state function, the problem
would also be restoring the "correct" frame pointer. 

I've tried to solve this problem by storing r7 and r11 at fixed locations in
the jmpbuf and restoring them unconditionally from the "correct location" in
the corresponding builtin_longjmp pattern. I am currently testing a patch for
this.

The other idea I had was to check for the lower bit of the label being restored
for Thumb"ness" and then load the appropriate frame pointer. Kludgy but that
might be the path of least risk to get this truly fixed. 




-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14202



More information about the Gcc-bugs mailing list