comparison lwasm/pseudo.c @ 198:6ddc861a07d4

Allow export to import undefined symbols
author lost
date Sun, 22 Mar 2009 18:26:59 +0000
parents bfd0fb0a85c2
children 188037f0397c
comparison
equal deleted inserted replaced
197:12fb4e8d5236 198:6ddc861a07d4
1080 1080
1081 1081
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))
1086 {
1087 // import the symbol
1088 if (as -> csect)
1089 {
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);
1095 }
1085 if (!se) 1096 if (!se)
1086 { 1097 {
1087 register_error(as, l, 2, "Exported symbols must be fully defined within a section"); 1098 register_error(as, l, 2, "Exported symbols must be fully defined within a section");
1088 return; 1099 return;
1089 } 1100 }