Skip to content

Commit 94b70c5

Browse files
authored
Rename internal SYSTEM_JS_LIBRARIES setting. NFC (#14742)
Also be consistent about using relative paths for elements of this list that are actually system libraries.
1 parent a3b27c4 commit 94b70c5

File tree

4 files changed

+20
-18
lines changed

4 files changed

+20
-18
lines changed

emcc.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1744,15 +1744,15 @@ def default_setting(name, new_default):
17441744
settings.FILESYSTEM = 0
17451745
settings.SYSCALLS_REQUIRE_FILESYSTEM = 0
17461746
settings.FETCH = 1
1747-
settings.SYSTEM_JS_LIBRARIES.append((0, shared.path_from_root('src', 'library_asmfs.js')))
1747+
settings.JS_LIBRARIES.append((0, 'library_asmfs.js'))
17481748

17491749
# Explicitly drop linking in a malloc implementation if program is not using any dynamic allocation calls.
17501750
if not settings.USES_DYNAMIC_ALLOC:
17511751
settings.MALLOC = 'none'
17521752

17531753
if settings.FETCH and final_suffix in EXECUTABLE_ENDINGS:
17541754
state.forced_stdlibs.append('libfetch')
1755-
settings.SYSTEM_JS_LIBRARIES.append((0, shared.path_from_root('src', 'library_fetch.js')))
1755+
settings.JS_LIBRARIES.append((0, 'library_fetch.js'))
17561756
if settings.USE_PTHREADS:
17571757
settings.FETCH_WORKER_FILE = unsuffixed(os.path.basename(target)) + '.fetch.js'
17581758

@@ -1837,7 +1837,7 @@ def default_setting(name, new_default):
18371837
exit_with_error('USE_PTHREADS=2 is no longer supported')
18381838
if settings.ALLOW_MEMORY_GROWTH:
18391839
diagnostics.warning('pthreads-mem-growth', 'USE_PTHREADS + ALLOW_MEMORY_GROWTH may run non-wasm code slowly, see https://github.com/WebAssembly/design/issues/1271')
1840-
settings.SYSTEM_JS_LIBRARIES.append((0, shared.path_from_root('src', 'library_pthread.js')))
1840+
settings.JS_LIBRARIES.append((0, 'library_pthread.js'))
18411841
settings.EXPORTED_FUNCTIONS += [
18421842
'___emscripten_pthread_data_constructor',
18431843
'___pthread_tsd_run_dtors',
@@ -1872,7 +1872,7 @@ def default_setting(name, new_default):
18721872
# set location of worker.js
18731873
settings.PTHREAD_WORKER_FILE = unsuffixed(os.path.basename(target)) + '.worker.js'
18741874
else:
1875-
settings.SYSTEM_JS_LIBRARIES.append((0, shared.path_from_root('src', 'library_pthread_stub.js')))
1875+
settings.JS_LIBRARIES.append((0, 'library_pthread_stub.js'))
18761876

18771877
if settings.FORCE_FILESYSTEM and not settings.MINIMAL_RUNTIME:
18781878
# when the filesystem is forced, we export by default methods that filesystem usage
@@ -2853,14 +2853,14 @@ def consume_arg_file():
28532853
options.tracing = True
28542854
newargs[i] = ''
28552855
settings_changes.append("EMSCRIPTEN_TRACING=1")
2856-
settings.SYSTEM_JS_LIBRARIES.append((0, shared.path_from_root('src', 'library_trace.js')))
2856+
settings.JS_LIBRARIES.append((0, 'library_trace.js'))
28572857
elif check_flag('--emit-symbol-map'):
28582858
options.emit_symbol_map = True
28592859
settings.EMIT_SYMBOL_MAP = 1
28602860
elif check_flag('--bind'):
28612861
settings.EMBIND = 1
2862-
settings.SYSTEM_JS_LIBRARIES.append((0, shared.path_from_root('src', 'embind', 'emval.js')))
2863-
settings.SYSTEM_JS_LIBRARIES.append((0, shared.path_from_root('src', 'embind', 'embind.js')))
2862+
settings.JS_LIBRARIES.append((0, os.path.join('embind', 'emval.js')))
2863+
settings.JS_LIBRARIES.append((0, os.path.join('embind', 'embind.js')))
28642864
elif check_arg('--embed-file'):
28652865
options.embed_files.append(consume_arg())
28662866
elif check_arg('--preload-file'):
@@ -2884,7 +2884,7 @@ def consume_arg_file():
28842884
elif check_flag('--no-entry'):
28852885
options.no_entry = True
28862886
elif check_arg('--js-library'):
2887-
settings.SYSTEM_JS_LIBRARIES.append((i + 1, os.path.abspath(consume_arg_file())))
2887+
settings.JS_LIBRARIES.append((i + 1, os.path.abspath(consume_arg_file())))
28882888
elif check_flag('--remove-duplicates'):
28892889
diagnostics.warning('legacy-settings', '--remove-duplicates is deprecated as it is no longer needed. If you cannot link without it, file a bug with a testcase')
28902890
elif check_flag('--jcache'):
@@ -3575,12 +3575,12 @@ def process_libraries(state, linker_inputs):
35753575

35763576
new_flags.append((i, flag))
35773577

3578-
settings.SYSTEM_JS_LIBRARIES += libraries
3578+
settings.JS_LIBRARIES += libraries
35793579

3580-
# At this point processing SYSTEM_JS_LIBRARIES is finished, no more items will be added to it.
3580+
# At this point processing JS_LIBRARIES is finished, no more items will be added to it.
35813581
# Sort the input list from (order, lib_name) pairs to a flat array in the right order.
3582-
settings.SYSTEM_JS_LIBRARIES.sort(key=lambda lib: lib[0])
3583-
settings.SYSTEM_JS_LIBRARIES = [lib[1] for lib in settings.SYSTEM_JS_LIBRARIES]
3582+
settings.JS_LIBRARIES.sort(key=lambda lib: lib[0])
3583+
settings.JS_LIBRARIES = [lib[1] for lib in settings.JS_LIBRARIES]
35843584
state.link_flags = new_flags
35853585

35863586

src/modules.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ var LibraryManager = {
106106

107107
if (NODERAWFS) {
108108
// NODERAWFS requires NODEFS
109-
if (!SYSTEM_JS_LIBRARIES.includes('library_nodefs.js')) {
109+
if (!JS_LIBRARIES.includes('library_nodefs.js')) {
110110
libraries.push('library_nodefs.js');
111111
}
112112
libraries.push('library_noderawfs.js');
@@ -142,7 +142,7 @@ var LibraryManager = {
142142
}
143143

144144
// Add any explicitly specified system JS libraries to link to, add those to link.
145-
libraries = libraries.concat(SYSTEM_JS_LIBRARIES)
145+
libraries = libraries.concat(JS_LIBRARIES)
146146

147147
if (LZ4) {
148148
libraries.push('library_lz4.js');

src/parseTools.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1215,7 +1215,7 @@ function makeModuleReceiveWithVar(localName, moduleName, defaultValue, noAssert)
12151215
function makeRemovedFSAssert(fsName) {
12161216
assert(ASSERTIONS);
12171217
const lower = fsName.toLowerCase();
1218-
if (SYSTEM_JS_LIBRARIES.includes('library_' + lower + '.js')) return '';
1218+
if (JS_LIBRARIES.includes('library_' + lower + '.js')) return '';
12191219
return `var ${fsName} = '${fsName} is no longer included by default; build with -l${lower}.js';`;
12201220
}
12211221

src/settings_internal.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,11 @@ var FETCH_WORKER_FILE = '';
8888

8989
var WASI_MODULE_NAME = "wasi_snapshot_preview1";
9090

91-
// Specifies a list of Emscripten-provided JS libraries to link against.
92-
// (internal, use -lfoo or -lfoo.js to link to Emscripten system JS libraries)
93-
var SYSTEM_JS_LIBRARIES = [];
91+
// List of JS libraries explictly linked against. This includes JS system
92+
// libraries (specified via -lfoo or -lfoo.js) in addition to user libraries
93+
// passed via `--js-library`. It does not include implicitly linked libraries
94+
// added by the JS compiler.
95+
var JS_LIBRARIES = [];
9496

9597
// This will contain the emscripten version. This can be useful in combination
9698
// with RETAIN_COMPILER_SETTINGS

0 commit comments

Comments
 (0)