# HG changeset patch # User lost # Date 1232167060 0 # Node ID 6460a1fb5f1fd3ec6557fb61d6098fc73d588041 # Parent 41ff4686b46b0fc8e429197a69a64d1f5cc1bc3a Checkpoint: object format output diff -r 41ff4686b46b -r 6460a1fb5f1f src/output.c --- a/src/output.c Sat Jan 17 02:59:24 2009 +0000 +++ b/src/output.c Sat Jan 17 04:37:40 2009 +0000 @@ -202,6 +202,8 @@ { lwasm_line_t *l; sectiontab_t *s; + lwasm_symbol_ent_t *se; + int i; unsigned char buf[16]; @@ -271,6 +273,37 @@ writebytes("", 1, 1, of); + // now the local symbols + for (se = as -> symhead; se; se = se -> next) + { + // ignore symbols not in this section + if (se -> sect != s) + continue; + + if (se -> flags & SYMBOL_SET) + continue; + + if (se -> flags & SYMBOL_EXTERN) + continue; + + writebytes(se -> sym, strlen(se -> sym), 1, of); + if (se -> context >= 0) + { + writebytes("\x01", 1, 1, of); + sprintf(buf, "%d", se -> context); + writebytes(buf, strlen(buf), 1, of); + } + // the "" is NOT an error + writebytes("", 1, 1, of); + + // write the address + buf[0] = (se -> value >> 8) & 0xff; + buf[1] = se -> value & 0xff; + writebytes(buf, 2, 1, of); + } + // flag end of local symbol table - "" is NOT an error + writebytes("", 1, 1, of); + // now blast out the code // length