diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-02-27 16:02:53 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-02-27 16:02:53 -0800 |
commit | 8acb7867b362073e4c0d402b632aebd0de8be9e3 (patch) | |
tree | 56b18789644f42678dd28c2e51328d95470187c9 | |
parent | b4605f200c14fefe6126d8e408edd00c15ac3280 (diff) |
make NO_EXIT_RUNTIME work properly with llvm lto
-rwxr-xr-x | emcc | 6 | ||||
-rw-r--r-- | tests/test_other.py | 6 |
2 files changed, 8 insertions, 4 deletions
@@ -1204,9 +1204,11 @@ try: logging.warning('jcache is deprecated and not supported in fastcomp (you should not need it anyhow), disabling') jcache = False + pre_fastcomp_opts = [] fastcomp_opts = [] if shared.Settings.NO_EXIT_RUNTIME: - fastcomp_opts += ['-emscripten-no-exit-runtime', '-globalopt'] + pre_fastcomp_opts += ['-emscripten-no-exit-runtime'] + if not llvm_lto: fastcomp_opts += ['-globalopt', '-globaldce'] fastcomp_opts += ['-pnacl-abi-simplify-preopt', '-pnacl-abi-simplify-postopt'] if shared.Settings.DISABLE_EXCEPTION_CATCHING != 1: fastcomp_opts += ['-enable-emscripten-cxx-exceptions'] @@ -1473,7 +1475,7 @@ try: else: if fastcomp and not save_bc: # Simplify LLVM bitcode for fastcomp - link_opts += fastcomp_opts + link_opts = pre_fastcomp_opts + link_opts + fastcomp_opts shared.Building.llvm_opt(final, link_opts) if DEBUG: save_intermediate('linktime', 'bc') if save_bc: diff --git a/tests/test_other.py b/tests/test_other.py index 49b9dcd1..8b507306 100644 --- a/tests/test_other.py +++ b/tests/test_other.py @@ -2417,7 +2417,7 @@ int main(int argc, char **argv) { ''') for no_exit in [0, 1]: - for opts in [[], ['-O1'], ['-O2', '-g2']]: + for opts in [[], ['-O1'], ['-O2', '-g2'], ['-O2', '-g2', '--llvm-lto', '1']]: print no_exit, opts Popen([PYTHON, EMCC] + opts + ['code.cpp', '-s', 'NO_EXIT_RUNTIME=' + str(no_exit)]).communicate() output = run_js(os.path.join(self.get_dir(), 'a.out.js'), stderr=PIPE, full_output=True, engine=NODE_JS) @@ -2496,7 +2496,9 @@ Waste<3> *getMore() { (['-O2', '-g'], True), (['-O2', '-g', '-s', 'NO_EXIT_RUNTIME=1'], False), # no-exit-runtime removes the atexits, and then globalgce can work it's magic to remove the global initializer entirely (['-Os', '-g'], True), - (['-Os', '-g', '-s', 'NO_EXIT_RUNTIME=1'], False), # no-exit-runtime removes the atexits, and then globalgce can work it's magic to remove the global initializer entirely + (['-Os', '-g', '-s', 'NO_EXIT_RUNTIME=1'], False), + (['-O2', '-g', '--llvm-lto', '1'], True), + (['-O2', '-g', '-s', 'NO_EXIT_RUNTIME=1', '--llvm-lto', '1'], False), ]: print opts, has_global Popen([PYTHON, EMCC, 'main.cpp', '-c'] + opts).communicate() |