[ARM] Why MI thunks are always implemented in ARM code?

Doug Kwan (關振德) dougkwan@google.com
Sat May 24 02:23:00 GMT 2008


2008/5/23 Paul Brook <paul@codesourcery.com>:

> Recent gcc is capable of generating pure Thumb thunks (and always does so for
> Thumb-2).

I noticed that in top-of-trunk but I am working thumb, not thumb2.

> Thumb branches have extremely limited range, and you can't clobber any low
> registers.  A combination of these two means that it's extremely hard to
> perform the tailcall or to add large offsets.
> I'm fairly sure there's also no way to guarantee that the thunkee is Thumb
> code.

I thought the MI thunks are emitted with the thunkee.  The
unconditional branch in thumb has 2K range and it should be sufficient
in many situations.  Currently, g++ emits MI thunks right before the
thunkee.

I am hacking a prototype to do this in the linker as a relaxation pass
but recognizing the thunk code seems very hacky to me.  The good thing
about the linker is that it can guarantee the branch target is in
thumb mode and in with the 2K range.

-Doug



More information about the Gcc mailing list