Skip to content

Re-allow -fPIC compiler flag during compilation #9750

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions emcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1896,9 +1896,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

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 @@ -8392,7 +8392,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')

@node_pthreads
Expand Down