comparison lwasm/section.c @ 380:cc154dc614fe

Added extdep pseudo back in
author lost@starbug
date Mon, 26 Apr 2010 19:44:44 -0600
parents d99322ef6f21
children cf8c92d70eb1
comparison
equal deleted inserted replaced
379:85b592c8b8f6 380:cc154dc614fe
267 for (; **p && isspace(**p); (*p)++) 267 for (; **p && isspace(**p); (*p)++)
268 /* do nothing */ ; 268 /* do nothing */ ;
269 goto again; 269 goto again;
270 } 270 }
271 } 271 }
272
273 PARSEFUNC(pseudo_parse_extdep)
274 {
275 int after = 0;
276 char *sym = NULL;
277 importlist_t *e;
278
279 if (as -> output_format != OUTPUT_OBJ)
280 {
281 lwasm_register_error(as, l, "EXTDEP only supported for object target");
282 return;
283 }
284
285 if (!as -> csect)
286 {
287 lwasm_register_error(as, l, "EXTDEP must be within a section");
288 return;
289 }
290
291 if (l -> sym)
292 sym = lw_strdup(l -> sym);
293
294 if (l -> sym)
295 {
296 skip_operand(p);
297 }
298
299 again:
300 if (after || !sym)
301 {
302 char *p2;
303
304 after = 1;
305 for (p2 = *p; *p2 && *p2 != ',' && !isspace(*p2); p2++)
306 /* do nothing */ ;
307
308 sym = lw_strndup(*p, p2 - *p);
309 }
310 if (!sym)
311 {
312 lwasm_register_error(as, l, "No symbol for EXTDEP");
313 return;
314 }
315
316 // create a zero-width dependency
317 {
318 lw_expr_t e;
319 e = lw_expr_build(lw_expr_type_int, 0);
320 lwasm_emitexpr(l, e, 0);
321 lw_expr_destroy(e);
322 }
323
324 if (after && **p == ',')
325 {
326 (*p)++;
327 for (; **p && isspace(**p); (*p)++)
328 /* do nothing */ ;
329 goto again;
330 }
331 }