comparison lwasm/pseudo.c @ 201:7824f94c5786

take 2: importing undefined exports
author lost
date Sun, 22 Mar 2009 20:07:37 +0000
parents 188037f0397c
children 1a75121c3c3f
comparison
equal deleted inserted replaced
200:3f9d299d2477 201:7824f94c5786
1082 // the symbol better be defined at this point (pass 2) 1082 // the symbol better be defined at this point (pass 2)
1083 // local symbols cannot be exported nor can "global" symbols 1083 // local symbols cannot be exported nor can "global" symbols
1084 se = lwasm_find_symbol(as, l -> sym, -1); 1084 se = lwasm_find_symbol(as, l -> sym, -1);
1085 if (!se && (as -> pragmas & PRAGMA_IMPORTUNDEFEXPORT)) 1085 if (!se && (as -> pragmas & PRAGMA_IMPORTUNDEFEXPORT))
1086 { 1086 {
1087 // import the symbol 1087 void *p;
1088 if (as -> csect) 1088 p = as -> csect;
1089 { 1089 as -> csect = NULL;
1090 register_error(as, l, 1, "Cannot declare external symbols within a section");
1091 return;
1092 }
1093
1094 lwasm_register_symbol(as, l, l -> sym, 0, SYMBOL_EXTERN); 1090 lwasm_register_symbol(as, l, l -> sym, 0, SYMBOL_EXTERN);
1091 as -> csect = p;
1095 } 1092 }
1096 else 1093 else
1097 { 1094 {
1098 if (!se) 1095 if (!se)
1099 { 1096 {
1100 register_error(as, l, 2, "Exported symbols must be fully defined within a section"); 1097 register_error(as, l, 2, "Exported symbols must be fully defined within a section");
1101 return; 1098 return;
1102 } 1099 }
1103 if (se -> sect == NULL) 1100 if (se -> sect == NULL)