Question

I am trying to mix ARM and THUMB instructions in my assembly code. For example, in the following code I try to use both modes:

.thumb  @ .code 16
.section __TEXT,__text
.globl mySymbol1
mySymbol1:
 ....
.arm   @ .code 32
.section __TEXT,__text
.globl mySymbol2
mySymbol2:
...

Now, as per my understanding when I compile this code into a library and run it through nm, mysymbol1 should show up as arm and mysymbol2 should show up as thumb, i.e,

0000xxxx (__TEXT,__text) external mySymbol1
0000yyyy (__TEXT,__text) external [Thumb] mySymbol2

But both are showing up as arm. What am I missing here? My assembler command is:

as -arch armv7 -o a.o a.s
Was it helpful?

Solution

you need .thumb_func before the thumb labels for them to be thumb targets otherwise the gnu tools will treat it as an arm target. (yes you need the .thumb once AND .thumb_func for EVERY label you want to use as a thumb target). Many examples http://github.com/dwelch67

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top