Mercurial > hg-old > index.cgi
comparison lwasm/output.c @ 375:3498b2d88376
Added export list to object output
author | lost@starbug |
---|---|
date | Mon, 26 Apr 2010 17:14:04 -0600 |
parents | d99322ef6f21 |
children | 91c0fe026940 |
comparison
equal
deleted
inserted
replaced
374:d99322ef6f21 | 375:3498b2d88376 |
---|---|
233 void write_code_obj(asmstate_t *as, FILE *of) | 233 void write_code_obj(asmstate_t *as, FILE *of) |
234 { | 234 { |
235 line_t *l; | 235 line_t *l; |
236 sectiontab_t *s; | 236 sectiontab_t *s; |
237 reloctab_t *re; | 237 reloctab_t *re; |
238 exportlist_t *ex; | |
238 struct symtabe *se; | 239 struct symtabe *se; |
239 | 240 |
240 int i; | 241 int i; |
241 unsigned char buf[16]; | 242 unsigned char buf[16]; |
242 | 243 |
323 } | 324 } |
324 // flag end of local symbol table - "" is NOT an error | 325 // flag end of local symbol table - "" is NOT an error |
325 writebytes("", 1, 1, of); | 326 writebytes("", 1, 1, of); |
326 | 327 |
327 // now the exports -- FIXME | 328 // now the exports -- FIXME |
328 /* for (ex = as -> exportlist; ex; ex = ex -> next) | 329 for (ex = as -> exportlist; ex; ex = ex -> next) |
329 { | 330 { |
330 int eval; | 331 int eval; |
331 ex -> se -> section != s) | 332 lw_expr_t te; |
332 continue; | 333 line_t tl; |
333 if (!lwasm_expr_exportable(ex -> se -> value)) | 334 |
334 continue; | 335 if (ex -> se -> section != s) |
335 eval = lwasm_expr_exportval(ex -> se -> value); | 336 continue; |
337 te = lw_expr_copy(ex -> se -> value); | |
338 as -> csect = ex -> se -> section; | |
339 as -> exportcheck = 1; | |
340 tl.as = as; | |
341 as -> cl = &tl; | |
342 lwasm_reduce_expr(as, te); | |
343 as -> exportcheck = 0; | |
344 as -> cl = NULL; | |
345 if (!lw_expr_istype(te, lw_expr_type_int)) | |
346 { | |
347 lw_expr_destroy(te); | |
348 continue; | |
349 } | |
350 eval = lw_expr_intval(te); | |
351 lw_expr_destroy(te); | |
336 writebytes(ex -> symbol, strlen(ex -> symbol) + 1, 1, of); | 352 writebytes(ex -> symbol, strlen(ex -> symbol) + 1, 1, of); |
337 buf[0] = (eval >> 8) & 0xff; | 353 buf[0] = (eval >> 8) & 0xff; |
338 buf[1] = eval & 0xff; | 354 buf[1] = eval & 0xff; |
339 writebytes(buf, 2, 1, of); | 355 writebytes(buf, 2, 1, of); |
340 } | 356 } |
341 */ | 357 |
342 // flag end of exported symbols - "" is NOT an error | 358 // flag end of exported symbols - "" is NOT an error |
343 writebytes("", 1, 1, of); | 359 writebytes("", 1, 1, of); |
344 | 360 |
345 // FIXME - relocation table | 361 // FIXME - relocation table |
346 /* for (re = s -> rl; re; re = re -> next) | 362 /* for (re = s -> rl; re; re = re -> next) |