Skip to content

Commit 2ac6d02

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 2ac6d02

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

tools/shared.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1920,28 +1920,29 @@ 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.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.EXPORT_ALL:
19311931
cmd.append('--export-all')
1932+
else:
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']
19321936

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']
1937+
cmd += ['--export', '__data_end']
19381938

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

19421942
if Settings.RELOCATABLE:
19431943
if Settings.SIDE_MODULE:
19441944
cmd.append('-shared')
1945+
cmd.append('--no-export-dynamic')
19451946
else:
19461947
cmd.append('-pie')
19471948

0 commit comments

Comments
 (0)