annotate old-trunk/lwasm/old/parse.c @ 348:11a95c6414b4

Added third func to instab to split resolve and emit logic
author lost@starbug
date Sat, 27 Mar 2010 22:15:07 -0600
parents eb230fa7d28e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
339
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1 /*
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
2 parse.c
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
3 Copyright © 2008 William Astle
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
4
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
5 This file is part of LWASM.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
6
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
7 LWASM is free software: you can redistribute it and/or modify it under the
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
8 terms of the GNU General Public License as published by the Free Software
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
9 Foundation, either version 3 of the License, or (at your option) any later
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
10 version.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
11
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
12 This program is distributed in the hope that it will be useful, but WITHOUT
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
15 more details.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
16
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
17 You should have received a copy of the GNU General Public License along with
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
18 this program. If not, see <http://www.gnu.org/licenses/>.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
19 */
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
20
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
21 /*
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
22 Contains the general parser
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
23 */
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
24
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
25 #define __parse_c_seen__
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
26 #include <config.h>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
27
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
28 #include <ctype.h>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
29 #include <string.h>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
30
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
31 #include "lwasm.h"
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
32 #include "instab.h"
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
33 #include "util.h"
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
34
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
35 // parse a line and despatch to the appropriate handlers for opcodes
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
36 int lwasm_parse_line(asmstate_t *as, lwasm_line_t *l)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
37 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
38 char *p, *p2;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
39 char *opc;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
40 int opnum;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
41 char *sym = NULL;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
42
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
43 // if this was a bad op first pass (or otherwise a no-process line)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
44 // ignore it
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
45 if (l -> badop)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
46 return;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
47
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
48 p = l -> text;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
49 l -> sect = as -> csect;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
50 l -> inmod = as -> inmod;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
51
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
52 // blank lines are a no brainer
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
53 if (!*p)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
54 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
55 as -> context = lwasm_next_context(as);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
56 return 0;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
57 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
58
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
59 // for output generation later but only on pass 1
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
60 // also used by some pseudo ops on pass 2
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
61 if (as -> passnum == 1)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
62 l -> codeaddr = as -> addr;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
63
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
64 // if it's a comment, return (this doesn't cause a context change)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
65 if (*p == '*' || *p == ';')
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
66 return;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
67
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
68 // if we have C pre-processor directives/output, ignore it
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
69 if (*p == '#')
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
70 return;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
71
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
72 // if we start with a non-space character, it's a symbol
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
73 if (!isspace(*p))
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
74 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
75 // we have a symbol specified here
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
76 // parse it out and record it for later use
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
77 for (p2 = p; *p2 && !isspace(*p2) && *p2 != ':'; p2++)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
78 /* do nothing */ ;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
79
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
80 sym = lwasm_alloc((p2 - p) + 1);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
81 sym[p2 - p] = '\0';
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
82 memcpy(sym, p, p2 - p);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
83
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
84 p = p2;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
85 if (!*sym)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
86 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
87 register_error(as, l, 1, "Invalid symbol");
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
88 lwasm_free(sym);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
89 sym = NULL;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
90 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
91 if (*p == ':')
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
92 p++;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
93 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
94 l -> sym = sym;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
95
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
96 // now skip any whitespace to find the opcode
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
97 while (*p && isspace(*p))
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
98 p++;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
99
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
100 // is the line blank?
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
101 if (!*p && !sym)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
102 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
103 // nothing but white space *is* a context break
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
104 as -> context = lwasm_next_context(as);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
105 return;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
106 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
107
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
108 // parse the opcode
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
109 for (p2 = p; *p2 && !isspace(*p2); p2++)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
110 /* do nothing */ ;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
111
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
112 opc = lwasm_alloc((p2 - p) + 1);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
113 memcpy(opc, p, p2 - p);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
114 opc[p2 - p] = '\0';
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
115
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
116 l -> forceglobal = 0;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
117 // if the opcode contains an =, treat it as "symbol = expr"
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
118 if (!sym && strchr(opc, '='))
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
119 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
120 for (p2 = opc; *p2 && *p2 != '='; p2++)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
121 /* do nothing */ ;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
122 sym = lwasm_alloc((p2 - opc) + 1);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
123 memcpy(sym, opc, p2 - opc);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
124 sym[p2 - opc] = '\0';
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
125 l -> sym = sym;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
126
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
127 p2 = p + (p2 - opc) + 1;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
128 // p2++;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
129 opc[0] = '=';
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
130 opc[1] = '\0';
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
131 debug_message(2, "Found opcode = with symbol %s and operand %s", sym, p2);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
132 l -> forceglobal = 1;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
133 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
134
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
135 debug_message(2, "Found operation code: '%s'", opc);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
136
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
137 // skip intervening whitespace if present
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
138 while (*p2 && isspace(*p2))
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
139 p2++;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
140
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
141 // look up instruction in insn table
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
142 for (opnum = 0; instab[opnum].opcode; opnum++)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
143 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
144 if (!strcasecmp(instab[opnum].opcode, opc))
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
145 break;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
146 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
147
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
148 // if we found no operation, check if we had a comment
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
149 // the reason this check is here is to allow for "private"
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
150 // operation codes like "*pragma" which will be ignored by
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
151 // other assemblers
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
152 // also skip empty ops
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
153 if (!(instab[opnum].opcode))
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
154 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
155 if (*opc == '*' || *opc == ';' || !*opc)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
156 goto done_line;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
157 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
158
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
159 // now we have the opcode and the symbol, we can decide if we're
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
160 // actually going to do anything with this line
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
161
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
162 // we will NOT call the function if any of the following are true:
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
163
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
164 // - we are skipping a condition and the operation code is not a conditional
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
165 // - we are defining a macro and the operation code is not ENDM
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
166
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
167 // we will call the function in any other circumstance
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
168
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
169 // first condition above
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
170 if (as -> inmacro && instab[opnum].endm == 0)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
171 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
172 add_macro_line(as, l -> text);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
173 goto done_line;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
174 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
175
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
176 // second condition above
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
177 if (as -> skipcond && instab[opnum].iscond == 0)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
178 goto done_line;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
179
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
180 // we've registered the symbol as needed
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
181 // now we need to check for a macro call IFF we don't collide with
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
182 // an operation code; otherwise, call the operation function
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
183 if (instab[opnum].opcode)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
184 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
185 if (instab[opnum].fn && !(as -> no6309 && instab[opnum].is6309))
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
186 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
187 (instab[opnum].fn)(as, l, &p2, opnum);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
188
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
189 // if we didn't end on a "space" character or EOL, throw error
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
190 if (*p2 && !isspace(*p2) && !(l -> err) && as -> passnum == 1)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
191 register_error(as, l, 1, "Bad operand: %s (%d)", p2, as -> passnum);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
192 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
193 else
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
194 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
195 // carp about unimplemented operation
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
196 if (instab[opnum].is6309)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
197 register_error(as, l, 1, "Use of 6309 operation code: %s", opc);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
198 else
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
199 register_error(as, l, 1, "Unimplemented operation code: %s", opc);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
200 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
201 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
202 else
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
203 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
204 if (expand_macro(as, l, &p2, opc) == 0)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
205 goto done_line;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
206
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
207 // carp about an unknown operation code and note that fact for
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
208 // pass 2 in case a macro appears later with the same name!
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
209 register_error(as, l, 1, "Uknown operation code: %s", opc);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
210 l -> badop = 1;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
211 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
212
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
213 done_line:
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
214 if (!(as -> skipcond || as -> inmacro))
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
215 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
216 // register symbol if the operation didn't
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
217 if (sym && instab[opnum].setsym == 0)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
218 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
219 if (as -> passnum == 1)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
220 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
221 debug_message(1, "Registering symbol '%s' at %04X", sym, l -> codeaddr);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
222 if (lwasm_register_symbol(as, l, sym, l -> codeaddr, SYMBOL_NORM) < 0)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
223 l -> sym = NULL;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
224 else
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
225 l -> addrset = 1;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
226 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
227 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
228 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
229
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
230 l -> sect = as -> csect;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
231 l -> context = as -> context;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
232
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
233 lwasm_free(opc);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
234 if (sym)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
235 lwasm_free(sym);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
236 }