comparison src/link.c @ 308:ecc092adc0be

Fixed stupid logic problem reading input files
author lost
date Fri, 23 Jan 2009 05:10:33 +0000
parents be1abc4ac114
children 5dc105fd619e
comparison
equal deleted inserted replaced
307:87c4e65074f0 308:ecc092adc0be
42 int laddr = 0; 42 int laddr = 0;
43 int ln, sn, fn; 43 int ln, sn, fn;
44 44
45 for (ln = 0; ln < linkscript.nlines; ln++) 45 for (ln = 0; ln < linkscript.nlines; ln++)
46 { 46 {
47 // printf("Linker script line %d: '%s', %04X, %d, %d\n", ln, linkscript.lines[ln].sectname, linkscript.lines[ln].loadat, linkscript.lines[ln].yesflags, linkscript.lines[ln].noflags);
47 if (linkscript.lines[ln].sectname) 48 if (linkscript.lines[ln].sectname)
48 { 49 {
49 int f = 0; 50 int f = 0;
50 // named section 51 // named section
51 // look for all instances of a section by the specified name 52 // look for all instances of a section by the specified name
52 // and resolve base addresses and add to the list 53 // and resolve base addresses and add to the list
53 for (fn = 0; fn < ninputfiles; fn++) 54 for (fn = 0; fn < ninputfiles; fn++)
54 { 55 {
55 for (sn = 0; sn < inputfiles[fn] -> nsections; sn++) 56 for (sn = 0; sn < inputfiles[fn] -> nsections; sn++)
56 { 57 {
58 // printf(" Considering %s:%s\n", inputfiles[fn]->filename, inputfiles[fn]->sections[sn].name);
57 if (!strcmp(linkscript.lines[ln].sectname, inputfiles[fn] -> sections[sn].name)) 59 if (!strcmp(linkscript.lines[ln].sectname, inputfiles[fn] -> sections[sn].name))
58 { 60 {
59 // we have a match 61 // we have a match
60 sectlist = lw_realloc(sectlist, sizeof(struct section_list) * (nsects + 1)); 62 sectlist = lw_realloc(sectlist, sizeof(struct section_list) * (nsects + 1));
61 sectlist[nsects].ptr = &(inputfiles[fn] -> sections[sn]); 63 sectlist[nsects].ptr = &(inputfiles[fn] -> sections[sn]);