public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* sizeof() in assembler
@ 2004-09-01  7:28 Massimiliano Cialdi
  2004-09-01  7:41 ` Jakub Jelinek
  0 siblings, 1 reply; 3+ messages in thread
From: Massimiliano Cialdi @ 2004-09-01  7:28 UTC (permalink / raw)
  To: binutils ML

I can define the size of an object:

  .section .rodata
  .align 1
str:
  .ascii "+++***+++\r\n"
  .size	str, .-str


there exist something like sizeof(str) to retrive the size of object
str?

thanks


-- 
Massimiliano Cialdi
cialdi@firenze.net
m.cialdi@oksys.it

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: sizeof() in assembler
  2004-09-01  7:28 sizeof() in assembler Massimiliano Cialdi
@ 2004-09-01  7:41 ` Jakub Jelinek
  2004-09-01 10:16   ` Massimiliano Cialdi
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Jelinek @ 2004-09-01  7:41 UTC (permalink / raw)
  To: Massimiliano Cialdi; +Cc: binutils ML

On Wed, Sep 01, 2004 at 09:28:26AM +0200, Massimiliano Cialdi wrote:
> I can define the size of an object:
> 
>   .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

	Jakub

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: sizeof() in assembler
  2004-09-01  7:41 ` Jakub Jelinek
@ 2004-09-01 10:16   ` Massimiliano Cialdi
  0 siblings, 0 replies; 3+ messages in thread
From: Massimiliano Cialdi @ 2004-09-01 10:16 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: binutils

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-09-01 10:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-01  7:28 sizeof() in assembler Massimiliano Cialdi
2004-09-01  7:41 ` Jakub Jelinek
2004-09-01 10:16   ` Massimiliano Cialdi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).