gas: macro to define string constant

Massimiliano Cialdi cialdi@firenze.net
Wed Sep 1 10:47:00 GMT 2004


I have:

str_first:
    .ascii "first string\r\n"
    sizeof_str_first = .-str_first
    .size str_first, sizeof_str_first
str_second:
    .ascii "second string\r\n"
    sizeof_str_second = .-str_second
    .size str_second, sizeof_str_second
s_error:
    .ascii "error string\r\n"
    sizeof_s_error = .-s_error
   .size s_error, sizeof_s_error

so I wont to do something like:

.macro def_str name, value
\nome:
  .ascii \value "\r\n"
  sizeof_\name = .-\name
  .size \name, sizeof_\name
.endm

def_str str_first, "first string"
def_str str_second, "error string"
def_str s_error, "error string"

but assembler gives me a warning:
rest of line ignored; first ignored character is 'f'

I cannot understand.

how to define this macro?

thanks

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



More information about the Binutils mailing list