changeset 377:55ed7d06b136

Fixed intersection internal references in object target
author lost@starbug
date Mon, 26 Apr 2010 18:37:06 -0600
parents 91c0fe026940
children 1c31e9005ff7
files lwasm/output.c
diffstat 1 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lwasm/output.c	Mon Apr 26 17:59:30 2010 -0600
+++ b/lwasm/output.c	Mon Apr 26 18:37:06 2010 -0600
@@ -316,9 +316,15 @@
 		switch (v)
 		{
 		case lwasm_expr_secbase:
-			writebytes("\x05", 1, 1, of);
-			break;
-		
+			{
+				// replaced with a synthetic symbol
+				sectiontab_t *se;
+				se = lw_expr_specptr(e);
+				
+				writebytes("\x03\x02", 1, 1, of);
+				writebytes(se -> name, strlen(se -> name) + 1, 1, of);
+				break;
+			}	
 		case lwasm_expr_import:
 			{
 				importlist_t *ie;
@@ -422,6 +428,10 @@
 		writebytes("", 1, 1, of);
 		
 		// now the local symbols
+		
+		// a symbol for section base address
+		writebytes("\x02", 1, 1, of);
+		writebytes(s -> name, strlen(s -> name) + 1, 1, of);
 		for (se = as -> symtab.head; se; se = se -> next)
 		{
 			// ignore symbols not in this section