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]

recursive gas macros and handling characters/strings


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

Attachment: signature.asc
Description: This is a digitally signed message part.


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