aboutsummaryrefslogtreecommitdiff
path: root/emcc
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-12-10 13:50:43 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-12-21 10:47:39 -0800
commit7f1fdbef4c074f0a026e5bf3ed01f0339cc8d939 (patch)
treea27478b27955c261d6c48aedc214b6425a2863ae /emcc
parent34b153227d5343128cb36931b4dbb27e378372a5 (diff)
be careful with internalize in llvm LTO, and mark needed symbols for relooper
Diffstat (limited to 'emcc')
-rwxr-xr-xemcc20
1 files changed, 11 insertions, 9 deletions
diff --git a/emcc b/emcc
index 1b86ee9b..8151d7c6 100755
--- a/emcc
+++ b/emcc
@@ -1055,17 +1055,19 @@ try:
if DEBUG: save_intermediate('opt', 'bc')
# Do LTO in a separate pass to work around LLVM bug XXX (see failure e.g. in cubescript)
if shared.Building.can_build_standalone():
- if llvm_lto and shared.Building.can_use_unsafe_opts():
- if not shared.Building.can_inline(): link_opts.append('-disable-inlining')
- link_opts.append('-std-link-opts')
- else:
- # At least remove dead functions etc., this potentially saves a lot in the size of the generated code (and the time to compile it)
- exports = ','.join(map(lambda exp: exp[1:], shared.Settings.EXPORTED_FUNCTIONS))
- link_opts += ['-internalize', '-internalize-public-api-list=' + exports, '-globaldce']
- if link_opts:
+ # At minimum remove dead functions etc., this potentially saves a lot in the size of the generated code (and the time to compile it)
+ exports = ','.join(map(lambda exp: exp[1:], shared.Settings.EXPORTED_FUNCTIONS))
+ # internalize carefully, llvm 3.2 will remove even main if not told not to
+ link_opts += ['-internalize', '-internalize-public-api-list=' + exports, '-globaldce']
if DEBUG: print >> sys.stderr, 'emcc: LLVM linktime:', link_opts
shared.Building.llvm_opt(in_temp(target_basename + '.bc'), link_opts)
- if DEBUG: save_intermediate('linktime', 'bc')
+ if DEBUG: save_intermediate('dce', 'bc')
+ if llvm_lto and shared.Building.can_use_unsafe_opts():
+ if not shared.Building.can_inline(): link_opts.append('-disable-inlining')
+ link_opts = ['-std-link-opts', '-disable-internalize']
+ if DEBUG: print >> sys.stderr, 'emcc: LLVM linktime:', link_opts
+ shared.Building.llvm_opt(in_temp(target_basename + '.bc'), link_opts)
+ if DEBUG: save_intermediate('linktime', 'bc')
# Prepare .ll for Emscripten
if not LEAVE_INPUTS_RAW: