Mercurial > hg > index.cgi
comparison lwlink/map.c @ 234:d389adbcc4ab
Added section base and length symbols to lwlink
Added the ability for a link script to define section base and section
length symbols when linking. These symbols are searched for when an external
reference is resolved before looking up any symbols in the various objects
being linked. Also documented the new link script directives and added such
directives to all default link scripts.
author | William Astle <lost@l-w.ca> |
---|---|
date | Fri, 10 Aug 2012 23:47:56 -0600 |
parents | fc8386b13399 |
children |
comparison
equal
deleted
inserted
replaced
233:7887a48b74df | 234:d389adbcc4ab |
---|---|
46 int std = 0; | 46 int std = 0; |
47 struct symliste *slist = NULL; | 47 struct symliste *slist = NULL; |
48 struct symliste *ce, *pe, *ne; | 48 struct symliste *ce, *pe, *ne; |
49 symtab_t *sym; | 49 symtab_t *sym; |
50 int i; | 50 int i; |
51 symlist_t *se; | |
51 | 52 |
52 if (!strcmp(map_file, "-")) | 53 if (!strcmp(map_file, "-")) |
53 { | 54 { |
54 std = 1; | 55 std = 1; |
55 of = stdout; | 56 of = stdout; |
75 sectlist[sn].ptr -> codesize | 76 sectlist[sn].ptr -> codesize |
76 ); | 77 ); |
77 } | 78 } |
78 | 79 |
79 // generate a sorted list of symbols and display it | 80 // generate a sorted list of symbols and display it |
81 | |
82 for (se = symlist; se; se = se -> next) | |
83 { | |
84 for (pe = NULL, ce = slist; ce; ce = ce -> next) | |
85 { | |
86 i = strcmp(ce -> name, se -> sym); | |
87 if (i > 0) | |
88 { | |
89 break; | |
90 } | |
91 pe = ce; | |
92 } | |
93 | |
94 ne = lw_alloc(sizeof(struct symliste)); | |
95 ne -> ext = 1; | |
96 ne -> addr = se -> val; | |
97 ne -> next = ce; | |
98 ne -> name = se -> sym; | |
99 ne -> fn = "<synthetic>"; | |
100 if (pe) | |
101 pe -> next = ne; | |
102 else | |
103 slist = ne; | |
104 } | |
105 | |
80 for (sn = 0; sn < nsects; sn++) | 106 for (sn = 0; sn < nsects; sn++) |
81 { | 107 { |
82 for (sym = sectlist[sn].ptr -> localsyms; sym; sym = sym -> next) | 108 for (sym = sectlist[sn].ptr -> localsyms; sym; sym = sym -> next) |
83 { | 109 { |
84 for (pe = NULL, ce = slist; ce; ce = ce -> next) | 110 for (pe = NULL, ce = slist; ce; ce = ce -> next) |