This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: ARM/Thumb Interwork
- From: Richard Earnshaw <rearnsha at arm dot com>
- To: "Bhattacharya, Soubhik" <soubhik_bhattacharya at mentorg dot com>
- Cc: Richard dot Earnshaw at arm dot com, "Bhattacharya, Soubhik" <soubhik_bhattacharya at mentor dot com>, crossgcc at sources dot redhat dot com, binutils at sources dot redhat dot com
- Date: Wed, 29 Oct 2003 11:05:02 +0000
- Subject: Re: ARM/Thumb Interwork
- Organization: ARM Ltd.
- Reply-to: Richard dot Earnshaw at arm dot com
> what about the functions that have a mix of arm/thumb? is there a
> general rule to distinguish between arm/thumb code within such functions?
The type of the label describes only the type of the first instruction in
the function. So if the first instruction is Thumb, then the function
will be marked STT_THUMB_FUNC; otherwise it will be marked STT_FUNC.
>
> examples of such functions are
> 1. a function compiled with -mcallee-super-interworking
Callee-super-interworking is a hack. Don't use it unless you really
really have to (it can't, for example, work with variadic functions, and
it may not work for any functions that pass arguments on the stack).
> 2. __<arm_func>_from_thumb
>
> is there any other kind of function that can have mix of arm/thumb?
Theoretically any function can be a mix of ARM and Thumb. A compiler
won't normally generate them itself (at least, the current incarnation of
gcc won't), but hand-written assembler can certainly contain a mix. I
would expect that with time, as GCC becomes smarter you might find more
and more object files that contain a mix of ARM and thumb code.
> in case of 1, the function is marked as arm, and the thumb code begins
> with a label of the form '.real_start_of<funcname>'.
> in case of 2, the function is marked as thumb, and arm code begins with
> a label of the form '__<arm_function_to_be_called>_change_to_arm'.
>
> both the labels have type STT_NOTYPE in symtab. so is it the label name
> that is being used to distinguish between arm/thumb? if yes, is there
> any other label name that is used for this purpose?
>
STT_NOTYPE says that it doesn't know the type of the label, so you just
can't tell. This is where the GNU model of doing this breaks down,
particularly for debuggers. STT_NOTYPE labels shouldn't really be
exported from an object file, so in general it shouldn't really matter
what type of instruction or data they address, since the only things that
care are internal to the object and hence already know the type.
> the numeric value of STT_THUMB_FUNC is 13, right?
It's whatever value is defined in binutils' include/elf/arm.h file.
R.