What optimisation option is needed to prod arm-elf-gcc -mthumb to
generate a tail call? ARM works as expected.
Please cc me in your reply. Thanks!
Shaun
arm-elf-gcc (GCC) 4.1.0
$ cat <<EOF >tail.c
int tail(void);
int main()
{
return tail();
}
EOF
$ arm-elf-gcc -mthumb -S -O2 tail.c
$ sed -ne '/^main/,/pop/p' tail.s
main:
push {lr}
bl tail
@ sp needed for prologue
pop {pc}
.size main, .-main
.ident "GCC: (GNU) 4.1.0"
$ arm-elf-gcc -S -O2 tail.c
$ sed -ne '/^main/,/pop/p' tail.s
main:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
@ lr needed for prologue
b tail
.size main, .-main
.ident "GCC: (GNU) 4.1.0"