Syntax to make .altmacro feature %EXPR work?
Erik Christiansen
dvalin@internode.on.net
Sat Jan 6 02:09:00 GMT 2018
More information about the Binutils mailing list
Sat Jan 6 02:09:00 GMT 2018
- Previous message (by thread): [PATCH] RISC-V: Print symbol address for jalr w/ zero offset.
- Next message (by thread): Syntax to make .altmacro feature %EXPR work?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Attempting to generate three symbols, fred0, fred1, fred2, is thwarted
by errors, despite various guesses at legal %EXPR syntax:
.altmacro
.macro foo hoo hah
.equ fred%(\hoo) , \hah
.endm
i = 0
.rept 3
foo i (42+i)
i = i + 1
.endr
gives, three times: Error: expected comma after "fred"
The list file shows: >> .equ fred%(i(42+i)),
Adding a separator: .equ fred%(\hoo)& , \hah
gives a listing of: >> .equ fred%(i(42+i))&,
Maybe %EXPR doesn't support macro parameter expansion? Let's try:
.altmacro
.macro foo n hah
i = 0
.rept \n
.equ fred%(i)& , \hah&+i
i = i + 1
.endr
.endm
foo 3 42
The error message is still:
Error: expected comma after "fred"
and the listing is a much improved: >> .equ fred%(i)&,42+i
But the % operator then appears to be running past the '&' separator, to
swallow all of the rest of the line.
Is there currently a way to elicit the documented behaviour with a
textually bounded expression?:
»
`Expression results as strings'
You can write `%EXPR' to evaluate the expression EXPR and use the
result as a string.
«
The attempts were made both with the latest avr-as version on my recent
debian install: 2.26.20160125, and version 2.28 i686 native gas.
Erik
- Previous message (by thread): [PATCH] RISC-V: Print symbol address for jalr w/ zero offset.
- Next message (by thread): Syntax to make .altmacro feature %EXPR work?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list