From 6d5f9f78bdc6cc21424809b1ae873d9946827588 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Mon, 28 Oct 2019 15:28:15 -0700 Subject: [PATCH] Re-allow `-fPIC` compiler flag during compilation We were temporally disabling this flag due to issues with PIC code in static linking. These issues should not be resolved. Fixes: #9013 --- emcc.py | 3 --- emscripten.py | 4 +--- tests/test_core.py | 1 - 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/emcc.py b/emcc.py index 33fef3d78edfc..8730c81d207a0 100755 --- a/emcc.py +++ b/emcc.py @@ -1896,9 +1896,6 @@ def is_link_flag(flag): return any(flag.startswith(x) for x in ('-l', '-L', '-Wl,')) compile_args = [a for a in newargs if a and not is_link_flag(a)] - if '-fPIC' in compile_args and not shared.Settings.RELOCATABLE: - shared.warning('ignoring -fPIC flag when not building with SIDE_MODULE or MAIN_MODULE') - compile_args.remove('-fPIC') # Bitcode args generation code def get_clang_command(input_files): diff --git a/emscripten.py b/emscripten.py index 4bcf5b961f95c..04e5c58a64d60 100644 --- a/emscripten.py +++ b/emscripten.py @@ -2414,9 +2414,7 @@ def create_asm_consts_wasm(forwarded_json, metadata): ', code, sigPtr, argbuf); }') if shared.Settings.RELOCATABLE: - # TODO(sbc): remove this conidtion after - # https://github.com/WebAssembly/binaryen/pull/2408 lands - preamble += '\n if (code >= %s) code -= %s;\n' % (shared.Settings.GLOBAL_BASE, shared.Settings.GLOBAL_BASE) + preamble += '\n code -= %s;\n' % shared.Settings.GLOBAL_BASE asm_const_funcs.append(r''' function %s(code, sigPtr, argbuf) {%s diff --git a/tests/test_core.py b/tests/test_core.py index 0a776240df398..e03591e4d9d3f 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -8392,7 +8392,6 @@ def test_undefined_main(self): def test_fpic_static(self): self.emcc_args.append('-fPIC') - self.emcc_args.remove('-Werror') self.do_run_in_out_file_test('tests', 'core', 'test_hello_world') @node_pthreads