Skip to content

Commit 0ebbdcf

Browse files
authored
Re-allow -fPIC compiler flag during compilation (#9750)
We were temporally disabling this flag due to issues with PIC code in static linking. These issues should not be resolved. Fixes: #9013
1 parent 38e9035 commit 0ebbdcf

File tree

3 files changed

+1
-7
lines changed

3 files changed

+1
-7
lines changed

emcc.py

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

18981898
compile_args = [a for a in newargs if a and not is_link_flag(a)]
1899-
if '-fPIC' in compile_args and not shared.Settings.RELOCATABLE:
1900-
shared.warning('ignoring -fPIC flag when not building with SIDE_MODULE or MAIN_MODULE')
1901-
compile_args.remove('-fPIC')
19021899

19031900
# Bitcode args generation code
19041901
def get_clang_command(input_files):

emscripten.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2414,9 +2414,7 @@ def create_asm_consts_wasm(forwarded_json, metadata):
24142414
', code, sigPtr, argbuf); }')
24152415

24162416
if shared.Settings.RELOCATABLE:
2417-
# TODO(sbc): remove this conidtion after
2418-
# https://github.com/WebAssembly/binaryen/pull/2408 lands
2419-
preamble += '\n if (code >= %s) code -= %s;\n' % (shared.Settings.GLOBAL_BASE, shared.Settings.GLOBAL_BASE)
2417+
preamble += '\n code -= %s;\n' % shared.Settings.GLOBAL_BASE
24202418

24212419
asm_const_funcs.append(r'''
24222420
function %s(code, sigPtr, argbuf) {%s

tests/test_core.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8392,7 +8392,6 @@ def test_undefined_main(self):
83928392

83938393
def test_fpic_static(self):
83948394
self.emcc_args.append('-fPIC')
8395-
self.emcc_args.remove('-Werror')
83968395
self.do_run_in_out_file_test('tests', 'core', 'test_hello_world')
83978396

83988397
@node_pthreads

0 commit comments

Comments
 (0)