Skip to content

Commit 234a00e

Browse files
committed
Strip -fPIC compiler flag during compilation
This is a partial revert of #9750. The binaryen change that was designed to allow this to work was reverted: WebAssembly/binaryen#2513
1 parent 0bebbec commit 234a00e

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

emcc.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1937,6 +1937,9 @@ def is_link_flag(flag):
19371937
return any(flag.startswith(x) for x in ('-l', '-L', '-Wl,'))
19381938

19391939
compile_args = [a for a in newargs if a and not is_link_flag(a)]
1940+
if '-fPIC' in compile_args and not shared.Settings.RELOCATABLE:
1941+
shared.warning('ignoring -fPIC flag when not building with SIDE_MODULE or MAIN_MODULE')
1942+
compile_args.remove('-fPIC')
19401943

19411944
# Bitcode args generation code
19421945
def get_clang_command(input_files):

tests/test_core.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8554,6 +8554,7 @@ def test_undefined_main(self):
85548554

85558555
def test_fpic_static(self):
85568556
self.emcc_args.append('-fPIC')
8557+
self.emcc_args.remove('-Werror')
85578558
self.do_run_in_out_file_test('tests', 'core', 'test_hello_world')
85588559

85598560
@node_pthreads

0 commit comments

Comments
 (0)