.set not recognized in gas parser
Sebastian D´Alessandro
sejawoya at yahoo.com.ar
Tue May 22 21:38:51 PDT 2007
Hello,
Today I started using the yasm assembler and I tried to assemble a TenDRA (ten15.org) output (GNU AS-compatible syntax) with the following source line in it:
.set .Ldisp14, 1756
Yasm complains:
main.s:6: label or instruction expected at start of line
I figured out that .set is not currently implemented in:
file: modules/parsers/gas/gas-parse.c
function: static yasm_bytecode *parse_line(yasm_parser_gas *parser_gas)
To solve the problem I added a case DIR_EQU in switch(curtok) as follows:
case DIR_EQU:
/* ID ',' expr */
get_next_token(); /* DIR_EQU */
if (!expect(ID)) return NULL;
id = ID_val;
get_next_token(); /* ID */
if (!expect(','))
{
yasm_xfree(id);
return NULL;
}
get_next_token(); /* ',' */
e = parse_expr(parser_gas);
if (e)
yasm_symtab_define_equ(p_symtab, id, e, cur_line);
else
yasm_error_set(YASM_ERROR_SYNTAX,
N_("expression expected after `%s'"), ",");
yasm_xfree(id);
return NULL;
/* end of code */
In http://www.gnu.org/software/binutils/manual/gas-2.9.1/html_mono/as.html#TOC47 I confirmed that .set is equivalent to give a symbol an arbitrary value, so the code above is similar to the one present in "case ID:" when after the ID there is a '=' token, even so, check it if you wish.
Best regards, Sebastian D'Alessandro.
---------------------------------
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cvs.tortall.net/pipermail/yasm-devel/attachments/20070523/b588f6e9/attachment.html
More information about the yasm-devel
mailing list