This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: recursive gas macros and handling characters/strings
- From: "Jan Beulich" <jbeulich at novell dot com>
- To: "Mike Frysinger" <vapier at gentoo dot org>
- Cc: <binutils at sourceware dot org>
- Date: Thu, 25 Oct 2007 08:37:00 +0100
- Subject: Re: recursive gas macros and handling characters/strings
- References: <200710242105.53866.vapier@gentoo.org>
>>> Mike Frysinger <vapier@gentoo.org> 25.10.07 03:05 >>>
>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 ?
It's not the macro parameter expansion that hurts you I assume, but the
quoted character handling (which is done in the scrubber, so the macro
never really gets the quoted character to see.
Jan