Thumb->ARM call and thumb-interwork problem on 4.7
Hello,
I have problem to call ARM coded assembler function from C Thumb code. It works fine on 4.6 2012q4
But it fails on 4.7 2013q1 and also in new 4.7 2013q2
Problem is that linker not change BL instruction to BLX when source is in Thumb code and target in ARM code. (thumb-interwork)
For explicit declaration for "thumb" function we have ".thumb_func" keyword. But we don't have keyword for explicit ARM function in assembler.
Is it bug in compiler or I am use it badly?
In case bug, do you have any work around? Except change assembler into "thumb"?
Jiri
Here is ASM code (file test.S):
=======
.syntax unified
.text
.code 32
.global test
.func test
test:
nop
bx lr
.endfunc
Here is C code (file c.c):
=======
void test (void);
int test2 (void)
{
test();
}
Script for compilation
=======
arm-none-eabi-gcc -c -mcpu=cortex-r4 -mthumb-interwork -Wa,-gdwarf2 -x assembler-with-cpp test.S
arm-none-eabi-gcc -c -mcpu=cortex-r4 -mthumb -mthumb-interwork -Wa,-gdwarf2 c.c
arm-none-eabi-gcc -o test.elf -mcpu=cortex-r4 -mthumb -mthumb-interwork -g -nostartfiles test.o c.o
arm-none-
And here is broken dissembled result with my note:
=======
Disassembly of section .text:
00008000 <test>:
8000: e320f000 nop {0}
8004: e12fff1e bx lr
00008008 <test2>:
8008: b580 push {r7, lr}
800a: af00 add r7, sp, #0
800c: f7ff fff8 bl 8000 <test> ; !!!!!!!!!!!! <- here must be BLX not BL
8010: 4618 mov r0, r3
8012: bd80 pop {r7, pc}
Question information
- Language:
- English Edit question
- Status:
- Solved
- Assignee:
- No assignee Edit question
- Solved by:
- Joey Ye
- Solved:
- Last query:
- Last reply: