@@ -750,21 +750,26 @@ def link(files, target, remove_duplicates=False):
750750 contents = filter (os .path .exists , map (os .path .abspath , contents ))
751751 added_contents = set ()
752752 added = True
753+ #print >> sys.stderr, ' initial undef are now ', unresolved_symbols, '\n'
753754 while added : # recursively traverse until we have everything we need
755+ #print >> sys.stderr, ' running loop of archive including for', f
754756 added = False
755757 for content in contents :
756758 if content in added_contents : continue
757759 new_symbols = Building .llvm_nm (content )
758760 # Link in the .o if it provides symbols, *or* this is a singleton archive (which is apparently an exception in gcc ld)
759761 #print >> sys.stderr, 'need', content, '?', unresolved_symbols, 'and we can supply', new_symbols.defs
762+ #print >> sys.stderr, content, 'DEF', new_symbols.defs, '\n'
760763 if new_symbols .defs .intersection (unresolved_symbols ) or len (files ) == 1 :
761764 if Building .is_bitcode (content ):
762- #print >> sys.stderr, ' adding object', content
765+ #print >> sys.stderr, ' adding object', content, '\n'
763766 resolved_symbols = resolved_symbols .union (new_symbols .defs )
764767 unresolved_symbols = unresolved_symbols .union (new_symbols .undefs .difference (resolved_symbols )).difference (new_symbols .defs )
768+ #print >> sys.stderr, ' undef are now ', unresolved_symbols, '\n'
765769 actual_files .append (content )
766770 added_contents .add (content )
767771 added = True
772+ #print >> sys.stderr, ' done running loop of archive including for', f
768773 finally :
769774 os .chdir (cwd )
770775 try_delete (target )
@@ -786,6 +791,7 @@ def link(files, target, remove_duplicates=False):
786791 seen_symbols = seen_symbols .union (symbols .defs )
787792
788793 # Finish link
794+ if DEBUG : print >> sys .stderr , 'emcc: llvm-linking:' , actual_files
789795 output = Popen ([LLVM_LINK ] + actual_files + ['-o' , target ], stdout = PIPE ).communicate ()[0 ]
790796 assert os .path .exists (target ) and (output is None or 'Could not open input file' not in output ), 'Linking error: ' + output + '\n emcc: If you get duplicate symbol errors, try --remove-duplicates'
791797 for temp_dir in temp_dirs :
0 commit comments