This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: ARM thumb-interwork libgcc asm functions have no bx
- To: Nick Clifton <nickc at cygnus dot com>
- Subject: Re: ARM thumb-interwork libgcc asm functions have no bx
- From: Richard Earnshaw <rearnsha at arm dot com>
- Date: Mon, 07 Aug 2000 10:56:53 +0100
- Cc: Giuliano dot Procida at red-m dot com, gcc at gcc dot gnu dot org, Simon dot Gooch at red-m dot com, gcc-bugs at gcc dot gnu dot org
- Cc: rearnsha at arm dot com
- Organization: ARM Ltd.
- Reply-To: rearnsha at arm dot com
> Hi Giuliano,
>
> : Some of the gcc/libgcc/interwork/*.o use BX, some don't (rm-elf-objdump -d
> : $i | grep -q bx && echo $i). The ones that do not use BX seem to all come
> : from:
> :
> : ../egcs-20000619/gcc/config/arm/lib1funcs.asm
>
> It sounds like you have a broken build of libgcc.a.
>
Nick,
I think Giuliano is right. Consider the following code snippets.
file1.c:
int foo(a, b)
{
return a / b;
}
file2.c:
int bar(a, b)
{
return a / b;
}
file3.c:
int main()
{
foo (55, 2);
bar (55, 2);
return 0;
}
gcc -O -c -minterwork file1.c
gcc -O -c -mthumb -minterwork file2.c
Now, lets link with the ARM interworking libraries:
gcc -minterwork file3.c file1.o file2.o -o arm-code
We then get the division routine from the ARM+interworking library (ARM
code): but this doesn't use a bx instruction to return, so the call from
within bar will fail to switch back to thumb mode on return.
So, lets link with the thumb interworking libraries:
gcc -minterwork -mthumb file3.c file1.o file2.o -o thumb-code
We then get the division routine from the Thumb+interworking library
(Thumb code): but this doesn't use a bx instruction either, so the call
from within foo will fail.
I'm having a think about the problem. It isn't entirely obvious what is
the best solution is (I'm not convinced we should be switching in and out
of thumb/ARM mode for such low-level routines).