Skip to content

Commit cb52a65

Browse files
author
Marco Trivellato
authored
Merge pull request #3 from Unity-Technologies/1.37.3-unity
1.37.3 unity
2 parents c853ee8 + 151e820 commit cb52a65

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

emcc.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,15 @@ def uniquename(name):
337337
seen_names[name] = str(len(seen_names))
338338
return unsuffixed(name) + '_' + seen_names[name] + (('.' + suffix(name)) if suffix(name) else '')
339339

340+
def asciify(strings_list):
341+
res = ''
342+
for s in strings_list:
343+
if isinstance(s, unicode):
344+
res += s.encode('ascii','ignore')
345+
else:
346+
res += s
347+
return res
348+
340349
# ---------------- End configs -------------
341350

342351
if len(sys.argv) == 1 or sys.argv[1] in ['x', 't']:
@@ -2131,7 +2140,7 @@ def do_minify(): # minifies the code. this is also when we do certain optimizati
21312140
if emit_symbol_map or shared.Settings.CYBERDWARF:
21322141
cmd += ['--symbolmap=' + target + '.symbols']
21332142
cmd += ['-o', wasm_binary_target]
2134-
logging.debug('asm2wasm (asm.js => WebAssembly): ' + ' '.join(cmd))
2143+
logging.debug('asm2wasm (asm.js => WebAssembly): ' + ' '.join(asciify(cmd)))
21352144
TimeLogger.update()
21362145
subprocess.check_call(cmd)
21372146
if import_mem_init:
@@ -2142,11 +2151,11 @@ def do_minify(): # minifies the code. this is also when we do certain optimizati
21422151
if shared.Settings.BINARYEN_PASSES:
21432152
shutil.move(wasm_binary_target, wasm_binary_target + '.pre')
21442153
cmd = [os.path.join(binaryen_bin, 'wasm-opt'), wasm_binary_target + '.pre', '-o', wasm_binary_target] + map(lambda p: '--' + p, shared.Settings.BINARYEN_PASSES.split(','))
2145-
logging.debug('wasm-opt on BINARYEN_PASSES: ' + ' '.join(cmd))
2154+
logging.debug('wasm-opt on BINARYEN_PASSES: ' + ' '.join(asciify(cmd)))
21462155
subprocess.check_call(cmd)
21472156
if 'interpret-s-expr' in shared.Settings.BINARYEN_METHOD:
21482157
cmd = [os.path.join(binaryen_bin, 'wasm-dis'), wasm_binary_target, '-o', wasm_text_target]
2149-
logging.debug('wasm-dis (binary => text): ' + ' '.join(cmd))
2158+
logging.debug('wasm-dis (binary => text): ' + ' '.join(asciify(cmd)))
21502159
subprocess.check_call(cmd)
21512160
if shared.Settings.BINARYEN_SCRIPTS:
21522161
binaryen_scripts = os.path.join(shared.Settings.BINARYEN_ROOT, 'scripts')

tools/shared.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1633,8 +1633,16 @@ def llvm_opt(filename, opts, out=None):
16331633

16341634
logging.debug('emcc: LLVM opts: ' + ' '.join(opts) + ' [num inputs: ' + str(len(inputs)) + ']')
16351635
target = out or (filename + '.opt.bc')
1636-
output = Popen([LLVM_OPT] + inputs + opts + ['-o', target], stdout=PIPE).communicate()[0]
1637-
assert os.path.exists(target), 'Failed to run llvm optimizations: ' + output
1636+
proc = Popen([LLVM_OPT] + inputs + opts + ['-o', target], stdout=PIPE)
1637+
output = proc.communicate()[0]
1638+
if proc.returncode != 0 or not os.path.exists(target):
1639+
logging.error('Failed to run llvm optimizations: ' + output)
1640+
for i in inputs:
1641+
if not os.path.exists(i):
1642+
logging.warning('Note: Input file "' + i + '" did not exist.')
1643+
elif not Building.is_bitcode(i):
1644+
logging.warning('Note: Input file "' + i + '" exists but was not an LLVM bitcode file suitable for Emscripten. Perhaps accidentally mixing native built object files with Emscripten?')
1645+
sys.exit(1)
16381646
if not out:
16391647
shutil.move(filename + '.opt.bc', filename)
16401648
return target

0 commit comments

Comments
 (0)