Skip to content

Commit 611bc72

Browse files
committed
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
1 parent 3dc4011 commit 611bc72

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
@@ -1883,9 +1883,6 @@ def is_link_flag(flag):
18831883
return any(flag.startswith(x) for x in ('-l', '-L', '-Wl,'))
18841884

18851885
compile_args = [a for a in newargs if a and not is_link_flag(a)]
1886-
if '-fPIC' in compile_args and not shared.Settings.RELOCATABLE:
1887-
shared.warning('ignoring -fPIC flag when not building with SIDE_MODULE or MAIN_MODULE')
1888-
compile_args.remove('-fPIC')
18891886

18901887
# Bitcode args generation code
18911888
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, 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
@@ -8377,7 +8377,6 @@ def test_undefined_main(self):
83778377

83788378
def test_fpic_static(self):
83798379
self.emcc_args.append('-fPIC')
8380-
self.emcc_args.remove('-Werror')
83818380
self.do_run_in_out_file_test('tests', 'core', 'test_hello_world')
83828381

83838382

0 commit comments

Comments
 (0)