This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: sizeof() in assembler
On Wed, 1 Sep 2004 07:23:50 +0200
Jakub Jelinek <jakub@redhat.com> wrote:
> > .section .rodata
> > .align 1
> > str:
> > .ascii "+++***+++\r\n"
> > .size str, .-str
> >
> >
> > there exist something like sizeof(str) to retrive the size of object
> > str?
>
> No.
> But you can always use
> str:
> .ascii "+++***+++\r\n"
> sizeof_str = .-str
> .size str, sizeof_str
does it works even if I use it in a macro?
.macro print str
STM.L (er4-er6),@-er7
STM.L (er0-er3),@-er7
mov.w #sizeof_\str,r1 ; dim
mov.l #\str,er0 ; addr
jsr @_Put
LDM.L @er7+,(er0-er3)
LDM.L @er7+,(er4-er6)
.endm
and then I use
print str
best regards
--
Massimiliano Cialdi
cialdi@firenze.net
m.cialdi@oksys.it