Skip to content

Commit

Permalink
Re-allow -fPIC compiler flag during compilation
Browse files Browse the repository at this point in the history
We were temporally disabling this flag due to issues with PIC code
in static linking.  These issues should not be resolved.

Fixes: #9013
  • Loading branch information
sbc100 committed Oct 31, 2019
1 parent 3dc4011 commit 611bc72
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 7 deletions.
3 changes: 0 additions & 3 deletions emcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1883,9 +1883,6 @@ 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):
Expand Down
4 changes: 1 addition & 3 deletions emscripten.py
Original file line number Diff line number Diff line change
Expand Up @@ -2414,9 +2414,7 @@ def create_asm_consts_wasm(forwarded_json, metadata):
', code, sigPtr, argbuf); }')

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

asm_const_funcs.append(r'''
function %s(code, sigPtr, argbuf) {%s
Expand Down
1 change: 0 additions & 1 deletion tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -8377,7 +8377,6 @@ 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')


Expand Down

0 comments on commit 611bc72

Please sign in to comment.