@@ -1333,16 +1333,23 @@ def __getitem__(self, key):
1333
1333
1334
1334
1335
1335
def verify_settings ():
1336
- if Settings .WASM_BACKEND and not Settings .WASM :
1337
- # TODO(sbc): Make this into a hard error. We still have a few places that
1338
- # pass WASM=0 before we can do this (at least Platform/Emscripten.cmake and
1339
- # generate_struct_info).
1340
- logging .debug ('emcc: WASM_BACKEND is not compatible with asmjs (WASM=0), forcing WASM=1' )
1341
- Settings .WASM = 1
1336
+ if Settings .WASM_BACKEND :
1337
+ if not Settings .WASM :
1338
+ # TODO(sbc): Make this into a hard error. We still have a few places that
1339
+ # pass WASM=0 before we can do this (at least Platform/Emscripten.cmake and
1340
+ # generate_struct_info).
1341
+ logging .debug ('emcc: WASM_BACKEND is not compatible with asmjs (WASM=0), forcing WASM=1' )
1342
+ Settings .WASM = 1
1343
+
1344
+ if not BINARYEN_ROOT :
1345
+ exit_with_error ('emcc: BINARYEN_ROOT must be set in the .emscripten config'
1346
+ ' when using the LLVM wasm backend' )
1347
+
1348
+ if Settings .CYBERDWARF :
1349
+ exit_with_error ('emcc: CYBERDWARF is not supported by the LLVM wasm backend' )
1342
1350
1343
- if Settings .WASM_BACKEND and not BINARYEN_ROOT :
1344
- exit_with_error ('emcc: BINARYEN_ROOT must be set in the .emscripten config'
1345
- ' when using the LLVM wasm backend' )
1351
+ if Settings .EMTERPRETIFY :
1352
+ exit_with_error ('emcc: EMTERPRETIFY is not is not supported by the LLVM wasm backend' )
1346
1353
1347
1354
1348
1355
Settings = SettingsManager ()
@@ -1921,7 +1928,7 @@ def wrapped():
1921
1928
'-z' ,
1922
1929
'stack-size=%s' % Settings .TOTAL_STACK ,
1923
1930
'--global-base=%s' % Settings .GLOBAL_BASE ,
1924
- '--initial-memory=%s ' % Settings .TOTAL_MEMORY ,
1931
+ '--initial-memory=%d ' % Settings .TOTAL_MEMORY ,
1925
1932
'-o' ,
1926
1933
target ,
1927
1934
'--no-entry' ,
@@ -1932,6 +1939,11 @@ def wrapped():
1932
1939
'--lto-O%d' % lto_level ,
1933
1940
] + files + [libc_rt_lib , compiler_rt_lib ]
1934
1941
1942
+ if Settings .WASM_MEM_MAX != - 1 :
1943
+ cmd .append ('--max-memory=%d' % Settings .WASM_MEM_MAX )
1944
+ elif not Settings .ALLOW_MEMORY_GROWTH :
1945
+ cmd .append ('--max-memory=%d' % Settings .TOTAL_MEMORY )
1946
+
1935
1947
for a in Building .llvm_backend_args ():
1936
1948
cmd += ['-mllvm' , a ]
1937
1949
@@ -2292,9 +2304,12 @@ def can_inline():
2292
2304
2293
2305
@staticmethod
2294
2306
def is_wasm_only ():
2307
+ # not even wasm, much less wasm-only
2295
2308
if not Settings .WASM :
2296
- return False # not even wasm, much less wasm-only
2297
- # if the asm.js code will not run, and won't be run through the js optimizer, then
2309
+ return False
2310
+ # llvm backend can only ever produce wasm
2311
+ if Settings .WASM_BACKEND :
2312
+ return True
2298
2313
# fastcomp can emit wasm-only code.
2299
2314
# also disable this mode if it depends on special optimizations that are not yet
2300
2315
# compatible with it.
0 commit comments