This is the mail archive of the crossgcc@cygnus.com mailing list for the crossgcc project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
From: hans@brandinnovators.com (Hans Zuidam) Date: Thu, 5 Mar 1998 10:15:18 +0100 (MET) Does someone know how to make zero filled strings in GAS? [I'm assuming you read the pseudo-ops section of the GAS manual and didn't find anything satisfactory. ... :-)] If I have a string "foo" and 8 bytes for it, I would like to have something which generates: .asciiz "foo" .byte 0, 0, 0, 0 without having to do finger arithmetic or use a symbol for each string. Thanks in advance, How about: .macro ascizn string, buflen ascizn\@: .asciz "\string" .org ascizn\@ + \buflen, 0 .endm ascizn "foo 3", 8 or .macro ascizn2 string, buflen 1: .asciz "\string" .org 1b + \buflen, 0 .endm ascizn2 "foo 3", 8 [I realize one gets an error if the arg to .asciz happens to be longer than 8 chars. Depending on the usage, one may want the error, so I'm leaving any further work as an exercise for the reader. :-)] [I also realize a symbol is actually used for each instance, which goes against what you asked for. I'm assuming that if done this way, that's ok. In the latter case no extra symbols appear in the resulting object file, and in the former case one could use the local label prefix to achieve the same thing.]