comparison lwlink/trunk/src/link.c @ 121:7bc853cb2ca9

Added simplistic output module for DECB target
author lost
date Thu, 22 Jan 2009 02:05:08 +0000
parents 36ce328df3c3
children 4ac96c697ef0
comparison
equal deleted inserted replaced
120:36ce328df3c3 121:7bc853cb2ca9
30 30
31 #include "expr.h" 31 #include "expr.h"
32 #include "lwlink.h" 32 #include "lwlink.h"
33 #include "util.h" 33 #include "util.h"
34 34
35 struct section_list 35 struct section_list *sectlist = NULL;
36 { 36 int nsects = 0;
37 section_t *ptr; // ptr to section structure
38 int forceaddr; // was this force to an address by the link script?
39 };
40
41 static struct section_list *sectlist = NULL;
42 static int nsects = 0;
43 37
44 // work out section load order and resolve base addresses for each section 38 // work out section load order and resolve base addresses for each section
45 // make a list of sections to load in order 39 // make a list of sections to load in order
46 void resolve_sections(void) 40 void resolve_sections(void)
47 { 41 {
222 void resolve_references(void) 216 void resolve_references(void)
223 { 217 {
224 int sn; 218 int sn;
225 reloc_t *rl; 219 reloc_t *rl;
226 int rval; 220 int rval;
221
222 // resolve entry point if required
223 // this must resolve to an *exported* symbol and will resolve to the
224 // first instance of that symbol
225 if (linkscript.execsym)
226 {
227 lw_expr_stack_t *s;
228
229 s = resolve_sym(linkscript.execsym, 0, NULL);
230 linkscript.execaddr = lw_expr_get_value(s);
231 lw_expr_stack_free(s);
232 }
227 233
228 for (sn = 0; nsects; sn++) 234 for (sn = 0; nsects; sn++)
229 { 235 {
230 for (rl = sectlist[sn].ptr -> incompletes; rl; rl = rl -> next) 236 for (rl = sectlist[sn].ptr -> incompletes; rl; rl = rl -> next)
231 { 237 {