This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: ARM interworking question
- From: Andrew Haley <aph at redhat dot com>
- To: ZoltÃn KÃcsi <zoltan at bendor dot com dot au>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 21 Jan 2009 09:42:14 +0000
- Subject: Re: ARM interworking question
- References: <20090121195356.5200e4f2@manocska.bendor.com.au>
ZoltÃn KÃcsi wrote:
> I have a question with regards to ARM interworking. The target is
> ARM7TDMI-S, embedded system with no OS. The compiler is arm-elf-gcc,
> 4.3.1 with binutils maybe 3 months old.
>
> It seems that when interworking is enabled then when a piece of THUMB
> code calls an other piece of THUMB code in a separate file, it calls
> a linker-generated entry point that switches the CPU to ARM mode, then
> a jump is executed to an ARM prologue inserted in front of the
> target THUMB function that switches the CPU back into THUMB mode. That
> is, instead of a simple call, a call, a jump and two mode switches are
> executed.
>
> I also tried the -mcallee-super-interworking flag, which generates a
> short ARM to THUMB switching code in front of a THUMB function, but the
> final result does not seem to use the .real_entry_ofFUNCTIONNAME entry
> point. Rather, it goes through the same switch back and forth routine.
>
> Is there a way so when both the caller and the callee are compiled with
> interworking support the end code switching modes only when it is
> necessary? For example, placing a THUMB -> ARM prologue in front of all
> functions that are in ARM mode and ARM -> THUMB prologue in front of
> THUMB functions and the caller simply calling the real function or the
> prologue, depending on its own mode and that of the target? It would
> save both code space and execution time.
I don't get it. How would this work? When you have a function pointer
you don't know if the target is thumb or ARM code, so how do you know
where to jump to? Perhaps you could sketch out an implementation.
Andrew.