diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-12-10 13:50:43 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-12-21 10:47:39 -0800 |
commit | 7f1fdbef4c074f0a026e5bf3ed01f0339cc8d939 (patch) | |
tree | a27478b27955c261d6c48aedc214b6425a2863ae /emcc | |
parent | 34b153227d5343128cb36931b4dbb27e378372a5 (diff) |
be careful with internalize in llvm LTO, and mark needed symbols for relooper
Diffstat (limited to 'emcc')
-rwxr-xr-x | emcc | 20 |
1 files changed, 11 insertions, 9 deletions
@@ -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: |