This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
ARM thumb-interwork libgcc asm functions have no bx
- To: gcc at gcc dot gnu dot org
- Subject: ARM thumb-interwork libgcc asm functions have no bx
- From: Giuliano Procida <Giuliano dot Procida at red-m dot com>
- Date: Fri, 4 Aug 2000 10:16:47 +0100
- Cc: Simon Gooch <Simon dot Gooch at red-m dot com>
With:
../egcs-20000619/configure
--with-gcc-version-trigger=/u/gprocida/lad-tools/egcs-20000619/gcc/version.c
--host=i686-pc-linux --srcdir=../egcs-20000619 --target=arm-elf
--with-headers=../newlib-1.8.2/newlib/libc/include --enable-multilib
--without-fp --with-cpu=arm7tdmi --norecursion
and the config/arm/t-arm-elf file edited to produce normal and interworking
libgcc variants (only).
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
In any case, returning from __udivsi3 to thumb code is broken. Example:
bar.c, compiled with -mthumb -mthumb-interwork
int main () {
volatile unsigned x = 20;
volatile unsigned y = 35;
unsigned z = y / x;
}
Relevant bits of objdump -d output:
bar: file format elf32-littlearm
Disassembly of section .text:
000080e0 <main>:
80e0: b590 push {r4, r7, lr}
80e2: 466f mov r7, sp
80e4: b083 sub sp, #12
80e6: ff95f002 bl b014 <____gccmain_from_thumb>
80ea: 46bc mov ip, r7
80ec: 1f3a sub r2, r7, #4
80ee: 2314 mov r3, #20
80f0: 6013 str r3, [r2, #0]
80f2: 46bc mov ip, r7
80f4: 1c3a mov r2, r7 (add r2, r7, #0)
80f6: 3a08 sub r2, #8
80f8: 2323 mov r3, #35
80fa: 6013 str r3, [r2, #0]
80fc: 46bc mov ip, r7
80fe: 1c3c mov r4, r7 (add r4, r7, #0)
8100: 3c0c sub r4, #12
8102: 46bc mov ip, r7
8104: 1c3a mov r2, r7 (add r2, r7, #0)
8106: 3a08 sub r2, #8
8108: 46bc mov ip, r7
810a: 1f3b sub r3, r7, #4
810c: 6810 ldr r0, [r2, #0]
810e: 6819 ldr r1, [r3, #0]
8110: ff84f002 bl b01c <____udivsi3_from_thumb>
8114: 1c03 mov r3, r0 (add r3, r0, #0)
8116: 1c03 mov r3, r0 (add r3, r0, #0)
8118: 6023 str r3, [r4, #0]
811a: 2000 mov r0, #0
811c: 46bd mov sp, r7
811e: bc90 pop {r4, r7}
8120: bc02 pop {r1}
8122: 4708 bx r1
00008124 <__udivsi3>:
8124: e3510000 cmp r1, #0 ; 0x0
8128: 0a00001f beq 81ac <Ldiv0>
812c: e3a03001 mov r3, #1 ; 0x1
8130: e3a02000 mov r2, #0 ; 0x0
8134: e1500001 cmp r0, r1
8138: 3a000019 bcc 81a4 <Lgot_result>
000081a4 <Lgot_result>:
81a4: e1a00002 mov r0, r2
81a8: e1a0f00e mov pc, lr
000081ac <Ldiv0>:
81ac: e52de004 str lr, [sp, -#4]!
81b0: eb000001 bl 81bc <__div0>
81b4: e3a00000 mov r0, #0 ; 0x0
81b8: e8bd8000 ldmia sp!, {pc}
000081bc <__div0>:
81bc: e1a0f00e mov pc, lr
0000b01c <____udivsi3_from_thumb>:
b01c: 4778 bx pc
b01e: 46c0 nop (mov r8,r8)
0000b020 <____udivsi3_change_to_arm>:
b020: eafff43f b 8124 <__udivsi3>
I hope this is pretty clear.
Giuliano.