diff options
Diffstat (limited to 'tools/shared.py')
-rw-r--r-- | tools/shared.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/tools/shared.py b/tools/shared.py index 86a5ba77..fdcdbbda 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -92,7 +92,7 @@ else: node = 'node' try: node = Popen(['which', 'node'], stdout=PIPE).communicate()[0].replace('\n', '') or \ - Popen(['which', 'nodejs'], stdout=PIPE).communicate()[0].replace('\n', '') + Popen(['which', 'nodejs'], stdout=PIPE).communicate()[0].replace('\n', '') or node except: pass config_file = config_file.replace('{{{ NODE }}}', node) @@ -749,21 +749,26 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e contents = filter(os.path.exists, map(os.path.abspath, contents)) added_contents = set() added = True + #print >> sys.stderr, ' initial undef are now ', unresolved_symbols, '\n' while added: # recursively traverse until we have everything we need + #print >> sys.stderr, ' running loop of archive including for', f added = False for content in contents: if content in added_contents: continue new_symbols = Building.llvm_nm(content) # Link in the .o if it provides symbols, *or* this is a singleton archive (which is apparently an exception in gcc ld) #print >> sys.stderr, 'need', content, '?', unresolved_symbols, 'and we can supply', new_symbols.defs + #print >> sys.stderr, content, 'DEF', new_symbols.defs, '\n' if new_symbols.defs.intersection(unresolved_symbols) or len(files) == 1: if Building.is_bitcode(content): - #print >> sys.stderr, ' adding object', content + #print >> sys.stderr, ' adding object', content, '\n' resolved_symbols = resolved_symbols.union(new_symbols.defs) unresolved_symbols = unresolved_symbols.union(new_symbols.undefs.difference(resolved_symbols)).difference(new_symbols.defs) + #print >> sys.stderr, ' undef are now ', unresolved_symbols, '\n' actual_files.append(content) added_contents.add(content) added = True + #print >> sys.stderr, ' done running loop of archive including for', f finally: os.chdir(cwd) try_delete(target) @@ -785,6 +790,7 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e seen_symbols = seen_symbols.union(symbols.defs) # Finish link + if DEBUG: print >>sys.stderr, 'emcc: llvm-linking:', actual_files output = Popen([LLVM_LINK] + actual_files + ['-o', target], stdout=PIPE).communicate()[0] assert os.path.exists(target) and (output is None or 'Could not open input file' not in output), 'Linking error: ' + output + '\nemcc: If you get duplicate symbol errors, try --remove-duplicates' for temp_dir in temp_dirs: @@ -1053,7 +1059,7 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e Building._is_ar_cache[filename] = sigcheck return sigcheck except Exception, e: - print 'shared.Building.is_ar failed to test whether file \'%s\' is a llvm archive file! Failed on exception: %s' % (filename, e) + print >> sys.stderr, 'shared.Building.is_ar failed to test whether file \'%s\' is a llvm archive file! Failed on exception: %s' % (filename, e) return False @staticmethod @@ -1073,7 +1079,7 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e assert os.path.exists(test_ll) try_delete(test_ll) except Exception, e: - print 'shared.Building.is_bitcode failed to test whether file \'%s\' is a llvm bitcode file! Failed on exception: %s' % (filename, e) + print >> sys.stderr, 'shared.Building.is_bitcode failed to test whether file \'%s\' is a llvm bitcode file! Failed on exception: %s' % (filename, e) return False # look for magic signature |