diff src/link.c @ 303:13272197d278

Added simplistic output module for DECB target
author lost
date Thu, 22 Jan 2009 02:05:08 +0000
parents eff969272fb9
children be1abc4ac114
line wrap: on
line diff
--- a/src/link.c	Wed Jan 21 06:14:08 2009 +0000
+++ b/src/link.c	Thu Jan 22 02:05:08 2009 +0000
@@ -32,14 +32,8 @@
 #include "lwlink.h"
 #include "util.h"
 
-struct section_list
-{
-	section_t *ptr;		// ptr to section structure
-	int forceaddr;		// was this force to an address by the link script?
-};
-
-static struct section_list *sectlist = NULL;
-static int nsects = 0;
+struct section_list *sectlist = NULL;
+int nsects = 0;
 
 // work out section load order and resolve base addresses for each section
 // make a list of sections to load in order
@@ -224,6 +218,18 @@
 	int sn;
 	reloc_t *rl;
 	int rval;
+
+	// resolve entry point if required
+	// this must resolve to an *exported* symbol and will resolve to the
+	// first instance of that symbol
+	if (linkscript.execsym)
+	{
+		lw_expr_stack_t *s;
+		
+		s = resolve_sym(linkscript.execsym, 0, NULL);
+		linkscript.execaddr = lw_expr_get_value(s);
+		lw_expr_stack_free(s);
+	}
 	
 	for (sn = 0; nsects; sn++)
 	{