Skip to content

Commit c83b1d4

Browse files
committed
Merge branch 'incoming' into asm_js
2 parents d9e1837 + 42b0339 commit c83b1d4

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

emcc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,8 @@ try:
806806
final_suffix = 'o'
807807

808808
# do not link in libs when just generating object code (not an 'executable', i.e. JS, or a library)
809-
if ('.' + final_suffix) in BITCODE_SUFFIXES:
809+
if ('.' + final_suffix) in BITCODE_SUFFIXES and len(libs) > 0:
810+
print >> sys.stderr, 'emcc: warning: not linking against libraries since only compiling to bitcode'
810811
libs = []
811812

812813
# Find library files

emscripten.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ def emscript(infile, settings, outfile, libraries=[]):
110110
elif line.find(' = type { ') > 0:
111111
pre.append(line) # type
112112
elif line.startswith('!'):
113+
if line.startswith('!llvm.module'): continue # we can ignore that
113114
meta.append(line) # metadata
114115
else:
115116
pre.append(line) # pre needs it so we know about globals in pre and funcs. So emit globals there

tools/shared.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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 + '\nemcc: If you get duplicate symbol errors, try --remove-duplicates'
791797
for temp_dir in temp_dirs:

0 commit comments

Comments
 (0)