Quick Links
force gcc to NOT use thumb?
#1
Posted 11 December 2010 - 01:09 PM
I'm using a Beagleboard with gcc
I'm looking for the parameter to use to ask gcc to not use thumb instruction !!!
does anybody know hox I con do that?
Thank's
Etienne
#2
Posted 11 December 2010 - 04:54 PM
-mthumb or -marm
Iso
#3
Posted 11 December 2010 - 10:09 PM
-marm seems to work thank's
but I still have some interrogation
I have tried this command
gcc -S -marm add.c
an the code produced is
.arch armv7-a
...
.file "add.c"
.text
.align 2
.global add
.type add, %function
add:
@ args = 0, pretend = 0, frame = 8
@ frame_needed = 1, uses_anonymous_args = 0
@ link register save eliminated.
...
bx lr
.size add, .-add
.ident "GCC: (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5"
.section .note.GNU-stack,"",%progbits
My problem is about the
bx lr instruction.
Bx intruction Does it not supposed to swap between ARM and thumb mode ?
Etienne
#4
Posted 04 January 2011 - 03:00 PM
webshaker, on 11 December 2010 - 10:09 PM, said:
bx lr instruction.
Bx intruction Does it not supposed to swap between ARM and thumb mode ?
BX <reg> is available in both ARM and Thumb state. It uses the low bit of the register value to determine if the destination is in ARM state (0) or Thumb state (1). In the case above if the caller is in Thumb state the low bit of LR will be set.
If you're compiling for a old ARM processor (e.g. XScale) that does not have Thumb state and therefore does not have BX in ARM state, then you should use -mcpu=... to tell the compiler.
You may have been thinking of the 'BLX <offset>' instruction which always switches state. The choice of using 'BLX <offset>' or 'BL <offset>' can be made by the linker, both the caller and callee states are known.
















