http://llvm.org/bugs/show_bug.cgi?id=8921
Summary: ARM/Thumb interoperability broken in v4T
Product: libraries
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: Backend: ARM
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
The following code generates wrong assembly when compiled to ARM:
extern int c();
int b()
{
return c()+1;
}
int a()
{
return b();
}
EABI requires ARM/Thumb interoperability by default (unless you know *exactly*
what you're doing, which is not the case). LLVM back-end (either through clang
or clang+llc) is generating b() as:
b:
push {r11, lr}
mov r11, sp
bl c
add r0, r0, #1
ldmia sp!, {r11, pc}
which doesn't take into account the instruction set change. The correct way to
return is "bx lr" as a default case. We're having problems when linking against
7TDMI libraries, since it has both ARM and Thumb functions.
The command lines:
$ clang -ccc-host-triple armv4t-none-eabi -mfloat-abi=softfp -S test.c
or
$ clang -ccc-host-triple armv4t-none-eabi -mfloat-abi=softfp -emit-llvm -S
test.c -o test.ll
$ llc -march=arm test.ll -o -
Attaching source, IR and assembly generated with trunk clang+llc.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs