Skip to content

wasm-backend: Don't export symbols by default from MAIN/SIDE_MODULEs #10081

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

Closed
wants to merge 1 commit into from
Closed
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
24 changes: 9 additions & 15 deletions tools/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -1920,28 +1920,22 @@ def link_lld(args, target, opts=[], lto_level=0):
not Settings.ASYNCIFY):
cmd.append('--strip-debug')

if Settings.RELOCATABLE:
if Settings.MAIN_MODULE == 2 or Settings.SIDE_MODULE == 2:
cmd.append('--no-export-dynamic')
else:
cmd.append('--no-gc-sections')
cmd.append('--export-dynamic')

if Settings.LINKABLE:
if Settings.EXPORT_ALL:
cmd.append('--export-all')
else:
# in standalone mode, crt1 will call the constructors from inside the wasm
if not Settings.STANDALONE_WASM:
cmd += ['--export', '__wasm_call_ctors']

# in standalone mode, crt1 will call the constructors from inside the wasm
if not Settings.STANDALONE_WASM:
cmd += ['--export', '__wasm_call_ctors']

cmd += ['--export', '__data_end']
cmd += ['--export', '__data_end']

for export in Settings.EXPORTED_FUNCTIONS:
cmd += ['--export', export[1:]] # Strip the leading underscore
for export in Settings.EXPORTED_FUNCTIONS:
cmd += ['--export', export[1:]] # Strip the leading underscore

if Settings.RELOCATABLE:
if Settings.SIDE_MODULE:
cmd.append('-shared')
cmd.append('--no-export-dynamic')
else:
cmd.append('-pie')

Expand Down