diff lwasm/section.c @ 387:a741d2e4869f

Various bugfixes; fixed lwobjdump to display symbols with unprintable characters more sensibly; start of a (nonfunctional for now) testing framework
author lost@l-w.ca
date Wed, 14 Jul 2010 20:15:23 -0600
parents cf8c92d70eb1
children 35a0b086bf4a
line wrap: on
line diff
--- a/lwasm/section.c	Sun May 16 13:03:17 2010 -0600
+++ b/lwasm/section.c	Wed Jul 14 20:15:23 2010 -0600
@@ -48,6 +48,8 @@
 		return;
 	}
 
+	l -> len = 0;
+
 	if (as -> csect)
 	{
 		lw_expr_destroy(as -> csect -> offset);
@@ -86,9 +88,13 @@
 	{
 		// create section data structure
 		s = lw_alloc(sizeof(sectiontab_t));
+		s -> oblen = 0;
+		s -> obsize = 0;
+		s -> obytes = NULL;
 		s -> name = lw_strdup(sn);
 		s -> offset = lw_expr_build(lw_expr_type_special, lwasm_expr_secbase, s);
 		s -> flags = section_flag_none;
+		s -> reloctab = NULL;
 		if (!strcasecmp(sn, "bss") || !strcasecmp(sn, ".bss"))
 		{
 			s -> flags |= section_flag_bss;
@@ -140,6 +146,8 @@
 		return;
 	}
 
+	l -> len = 0;
+
 	if (!(as -> csect))
 	{
 		lwasm_register_error(as, l, "ENDSECTION without SECTION");
@@ -171,6 +179,8 @@
 		lwasm_register_error(as, l, "EXPORT only supported for object target");
 		return;
 	}
+
+	l -> len = 0;
 	
 	if (l -> sym)
 	{
@@ -232,6 +242,8 @@
 		return;
 	}
 	
+	l -> len = 0;
+	
 	if (l -> sym)
 	{
 		sym = lw_strdup(l -> sym);
@@ -296,6 +308,8 @@
 		return;
 	}
 	
+	l -> len = 0;
+	
 	if (l -> sym)
 		sym = lw_strdup(l -> sym);