recursive gas macros and handling characters/strings
Mike Frysinger
vapier@gentoo.org
Thu Oct 25 02:30:00 GMT 2007
recently i did some work which required outputting a string in some code which
could not utilize any other section than the .text nor could use relocations
(think low level init bootstrap code that is run at power on). what i came
up with is something like:
send_string 'm', 'o', 'o', ' ', 'm', 'r', '.', ' ', 'c', 'o', 'w'
and the send_string macro was defined as:
.macro send_string byte:req morebytes:vararg
R0 = \byte;
call _push_out_char;
.ifnb \morebytes
send_string \morebytes
.endif
.endm
from my tests, it looks like the evaluation of arguments happens before the
expansion of the macro ... in other words, macro expansion isnt quite as
clean as cpp->c expansion. what i would have liked to do is:
send_string m, o, o, , m, r, ....
and then had the macro boil down to:
R0 = '\()\byte\()';
but this does not seem to work. am i missing something or is this correct ?
also, i couldnt seem to find a way to parse strings with the gas macro
language ... so what would have been ideal is:
send_string "moo mr. cow"
and then had the send_string macro actually parcel it up into the individual
bytes ... but i dont think that's possible to transfer between the data
representations in gas.
thanks in advance for any random points of enlightenment :)
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 827 bytes
Desc: This is a digitally signed message part.
URL: <https://sourceware.org/pipermail/binutils/attachments/20071025/1963ae23/attachment.sig>
More information about the Binutils
mailing list