aboutsummaryrefslogtreecommitdiff
path: root/emlink.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-07-01 13:09:59 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-07-03 15:31:05 -0700
commitcde6b80d99c6e4fd9eb0b67db929e51f93518b56 (patch)
tree6cc026a7e5bd5adcec8397f2d347b9249ca9113b /emlink.py
parentf4adccef1ae92a6da54d9c29a84fe64758f76201 (diff)
warn on undefined global variables after linking
Diffstat (limited to 'emlink.py')
-rw-r--r--emlink.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/emlink.py b/emlink.py
index d5b5cdf7..5d9bb32d 100644
--- a/emlink.py
+++ b/emlink.py
@@ -144,6 +144,14 @@ class AsmModule():
sendings_end = main.post_js.find(' }, buffer);')
main.post_js = main.post_js[:sendings_start] + sendings_js + main.post_js[sendings_end:]
+ # check for undefined references to global variables
+ def check_import(key, value):
+ if value.startswith('+') or value.endswith('|0'): # ignore functions
+ if key not in all_sendings:
+ print >> sys.stderr, 'external variable %s is still not defined after linking' % key
+ for key, value in self.imports.iteritems(): check_import(key, value)
+ for key, value in main.imports.iteritems(): check_import(key, value)
+
# tables
f_bases = {}
f_sizes = {}