Skip to content

Commit 1bf0514

Browse files
committed
wasm-backend: Don't export symbols by default from MAIN/SIDE_MODULEs
This matches the current behavior of fastcomp since #7371 disabled EXPORT_ALL for MAIN/SIDE_MODULEs. Since most of our dylink tests set EXPORT_ALL this didn't get noticed.
1 parent 5dba39c commit 1bf0514

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

tools/shared.py

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1920,28 +1920,22 @@ def link_lld(args, target, opts=[], lto_level=0):
19201920
not Settings.ASYNCIFY):
19211921
cmd.append('--strip-debug')
19221922

1923-
if Settings.RELOCATABLE:
1924-
if Settings.MAIN_MODULE == 2 or Settings.SIDE_MODULE == 2:
1925-
cmd.append('--no-export-dynamic')
1926-
else:
1927-
cmd.append('--no-gc-sections')
1928-
cmd.append('--export-dynamic')
1929-
1930-
if Settings.LINKABLE:
1923+
if Settings.EXPORT_ALL:
19311924
cmd.append('--export-all')
1925+
else:
1926+
# in standalone mode, crt1 will call the constructors from inside the wasm
1927+
if not Settings.STANDALONE_WASM:
1928+
cmd += ['--export', '__wasm_call_ctors']
19321929

1933-
# in standalone mode, crt1 will call the constructors from inside the wasm
1934-
if not Settings.STANDALONE_WASM:
1935-
cmd += ['--export', '__wasm_call_ctors']
1936-
1937-
cmd += ['--export', '__data_end']
1930+
cmd += ['--export', '__data_end']
19381931

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

19421935
if Settings.RELOCATABLE:
19431936
if Settings.SIDE_MODULE:
19441937
cmd.append('-shared')
1938+
cmd.append('--no-export-dynamic')
19451939
else:
19461940
cmd.append('-pie')
19471941

0 commit comments

Comments
 (0)