3.4.1.5 Expand Macros Listing Option
The
-am
form of this option expands
macros in a listing. The first example below shows a listing where the -am
option was not
used.GAS LISTING foo.s page 1
1 # 1 "foo.S"
2 # 1 "<built-in>"
1 .macro sum from=0, to=5
0
0
2 .long \from
3 .if \to-\from
4 sum "(\from+1)",\to
5 .endif
6 .endm
7
8 .data
9 0000 00000000 .long 0
10 0004 0A000000 sum 10, 14
10 0B000000
10 0C000000
10 0D000000
10 0E000000
11 0018 00000000 .long 0
This second example shows a listing for the same source where the
-am
option was
used.GAS LISTING foo.s page 1
1 # 1 "foo.S"
2 # 1 "<built-in>"
1 .macro sum from=0, to=5
0
0
2 .long \from
3 .if \to-\from
4 sum "(\from+1)",\to
5 .endif
6 .endm
7
8 .data
9 0000 00000000 .long 0
10 sum 10, 14
10 0004 0A000000 > .long 10
10 > .if 14-10
10 > sum "(10+1)",14
10 0008 0B000000 >> .long (10+1)
10 >> .if 14-(10+1)
10 >> sum "((10+1)+1)",14
10 000c 0C000000 >>> .long ((10+1)+1)
10 >>> .if 14-((10+1)+1)
10 >>> sum "(((10+1)+1)+1)",14
10 0010 0D000000 >>>> .long (((10+1)+1)+1)
10 >>>> .if 14-(((10+1)+1)+1)
10 >>>> sum "((((10+1)+1)+1)+1)",14
10 0014 0E000000 >>>>> .long ((((10+1)+1)+1)+1)
10 >>>>> .if 14-((((10+1)+1)+1)+1)
10 >>>>> sum "(((((10+1)+1)+1)+1)+1)",14
10 >>>>> .endif
10 >>>> .endif
10 >>> .endif
10 >> .endif
10 > .endif
11 0018 00000000 .long 0
Note: The
>
signifies expanded macro instructions.