-
Notifications
You must be signed in to change notification settings - Fork 122
/
equ.S
42 lines (32 loc) · 741 Bytes
/
equ.S
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* # equ
*
* # set
*
* `.equ` and `.set` are the same.
*
* http://stackoverflow.com/questions/21624155/difference-between-equ-and-word-in-arm-assembly
*
* - https://sourceware.org/binutils/docs/as/Equ.html
* - https://sourceware.org/binutils/docs/as/Set.html
*/
#include "lib/common_gas.h"
.data
.equ asdf, 0x1234567
ENTRY
.equ x, 0x1234567
mov $0, %eax
mov $x, %eax
ASSERT_EQ($0x1234567, %eax)
.set y, 0x1234567
mov $0, %eax
mov $y, %eax
ASSERT_EQ($0x1234567, %eax)
/* TODO: vs macro?
*
* One difference is that expressions can be used. Is that the main one?
*/
.set y, 2 * 1 + 1
mov $0, %eax
mov $y, %eax
ASSERT_EQ($0x3, %eax)
EXIT