diff --git a/emcc.py b/emcc.py index 836b38b30bfde..68aab417b6f31 100755 --- a/emcc.py +++ b/emcc.py @@ -1937,6 +1937,9 @@ 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/tests/test_core.py b/tests/test_core.py index c0cb5b969bb69..bde27a235a7dc 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -8554,6 +8554,7 @@ 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