Skip to content

Commit b393af6

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 62090e3 commit b393af6

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

emcc.py

-3
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

+3
Original file line numberDiff line numberDiff line change
@@ -2413,6 +2413,9 @@ def create_asm_consts_wasm(forwarded_json, metadata):
24132413
str(int(sync_proxy)) +
24142414
', code, sigPtr, argbuf); }')
24152415

2416+
if shared.Settings.RELOCATABLE:
2417+
preamble += '\n code -= %s;\n' % shared.Settings.GLOBAL_BASE
2418+
24162419
asm_const_funcs.append(r'''
24172420
function %s(code, sigPtr, argbuf) {%s
24182421
var args = readAsmConstArgs(sigPtr, argbuf);

tests/test_core.py

-1
Original file line numberDiff line numberDiff line change
@@ -8361,7 +8361,6 @@ def test_undefined_main(self):
83618361

83628362
def test_fpic_static(self):
83638363
self.emcc_args.append('-fPIC')
8364-
self.emcc_args.remove('-Werror')
83658364
self.do_run_in_out_file_test('tests', 'core', 'test_hello_world')
83668365

83678366

0 commit comments

Comments
 (0)