From 611bc72a38aeded2d8d02ec9a7e77e1b9bbb0000 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 5c9e17f25af4..9bb6f867b979 100755 --- a/emcc.py +++ b/emcc.py @@ -1883,9 +1883,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 db56aad5ff32..57e3cbf0ccfc 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, 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 e9b2ca1821c8..fadce8beead0 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -8377,7 +8377,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')