Discussion:
How to build an arm-thumb interworking glibc?
Rimpei Sosa
2003-06-05 01:49:37 UTC
Permalink
It seems that my glibc doesn't provide any arm-thumb interworking support.
What I'd like to achieve here is to call glibc's functions from thumb code.
How can I produce an arm-thumb interworking glibc?

Any advice would be appreciated,
Rimpei Sosa.

------
Here is an example:

main.c for main function using arm instructions set.
foo.c for sub function called by main using thumb instructions set.

$ cat main.c
void foo(void);
int main(void){
foo();
return ;
}

$cat foo.c
#include <stdio.h>
void foo(void){
printf("HelloWorld\n");
return ;
}

after compiling them with :
$ arm-linux-gcc -c -mthumb-interwork main.c

$ arm-linux-gcc -c -mthumb -mthumb-interwork foo.c

I got an error message shown below from ld when linking with glibc.

$ arm-linux-gcc -mthumb-interwork main.o foo.o

/tools/lib/gcc-lib/arm-linux/3.2/../../../../arm-linux/bin/ld: Warning: /tools/l
ib/gcc-lib/arm-linux/3.2/crtend.o does not support interworking, whereas a.out d
oes
/tools/lib/gcc-lib/arm-linux/3.2/../../../../arm-linux/bin/ld: Warning: /tools/l
ib/gcc-lib/arm-linux/3.2/../../../../arm-linux/lib/crtn.o does not support inter
working, whereas a.out does
/tools/lib/gcc-lib/arm-linux/3.2/../../../../arm-linux/bin/ld: foo.o: unable to
find THUMB glue '__printf@@GLIBC_2.0_from_thumb' for `printf@@GLIBC_2.0'
foo.o: In function `foo':
foo.o(.text+0x8): internal error: dangerous error

-------------------------------------------------------------------------------


-------------------------------------------------------------------
Subscription options: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
FAQ/Etiquette: http://www.arm.linux.org.uk/armlinux/mailinglists.php
Russell King - ARM Linux
2003-06-05 09:01:21 UTC
Permalink
Post by Rimpei Sosa
It seems that my glibc doesn't provide any arm-thumb interworking support.
What I'd like to achieve here is to call glibc's functions from thumb code.
How can I produce an arm-thumb interworking glibc?
I don't believe any work has been done on glibc to support thumb
interworking. The only library which supports thumb natively is
klibc (although I haven't worked on that for a while.) klibc is
rather small and basic though (which is mainly due to its design
requirements.)

I'm not aware of any other C library supporting Thumb. This doesn't
mean that there aren't any, it just means that if there is, no one
has mentioned it to this community.

-------------------------------------------------------------------
Subscription options: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
FAQ/Etiquette: http://www.arm.linux.org.uk/armlinux/mailinglists.php
Loading...