This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: recursive gas macros and handling characters/strings


>>> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]