Difference between .equ and .word in ARM Assembly?

jhtong picture jhtong · Feb 7, 2014 · Viewed 27k times · Source

I am curious - What is the difference between .equ and .word directives in ARM assembly, when defining constants?

Answer

old_timer picture old_timer · Feb 7, 2014

.equ is like #define in C:

#define bob 10
.equ bob, 10

.word is like unsigned int in C:

unsigned int ted;
ted: 
.word 0

Or initialized with a value:

unsigned int alice = 42;
alice:
.word 42