Skip to content

Deprecate the USES_DYNAMIC_ALLOC setting #19164

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

Merged
merged 1 commit into from
Apr 12, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ See docs/process.md for more on how version tagging works.

3.1.36 (in development)
-----------------------
- The `USES_DYNAMIC_ALLOC` setting has been deprecated. You can get the same
effect from `-sMALLOC=none`. (#19164)

3.1.35 - 04/03/23
-----------------
Expand Down
4 changes: 0 additions & 4 deletions emcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2331,10 +2331,6 @@ def phase_linker_setup(options, state, newargs):
'_wasmfs_readdir_finish',
]

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

if settings.FETCH and final_suffix in EXECUTABLE_ENDINGS:
state.forced_stdlibs.append('libfetch')
settings.JS_LIBRARIES.append((0, 'library_fetch.js'))
Expand Down
8 changes: 1 addition & 7 deletions src/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -1851,13 +1851,6 @@ var MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION = false;
// [link]
var MINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION = false;

// If building with MINIMAL_RUNTIME=1 and application uses sbrk()/malloc(),
// enable this. If you are not using dynamic allocations, can set this to 0 to
// save code size. This setting is ignored when building with -s
// MINIMAL_RUNTIME=0.
// [link]
var USES_DYNAMIC_ALLOC = true;

// If set to 'emscripten' or 'wasm', compiler supports setjmp() and longjmp().
// If set to 0, these APIs are not available. If you are using C++ exceptions,
// but do not need setjmp()+longjmp() API, then you can set this to 0 to save a
Expand Down Expand Up @@ -2175,4 +2168,5 @@ var LEGACY_SETTINGS = [
['LLD_REPORT_UNDEFINED', [1], 'Disabling is no longer supported'],
['MEM_INIT_METHOD', [0], 'No longer supported'],
['USE_PTHREADS', [0, 1], 'No longer needed. Use -pthread instead'],
['USES_DYNAMIC_ALLOC', [1], 'No longer supported. Use -sMALLOC=none'],
];
6 changes: 3 additions & 3 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -9993,14 +9993,14 @@ def test_minimal_runtime_code_size(self, test_name, js, compare_js_output=False)

math_sources = [test_file('code_size/math.c')]
hello_world_sources = [test_file('small_hello_world.c'),
'-sUSES_DYNAMIC_ALLOC=0']
'-sMALLOC=none']
random_printf_sources = [test_file('hello_random_printf.c'),
'-sUSES_DYNAMIC_ALLOC=0',
'-sMALLOC=none',
'-sSINGLE_FILE']
hello_webgl_sources = [test_file('minimal_webgl/main.cpp'),
test_file('minimal_webgl/webgl.c'),
'--js-library', test_file('minimal_webgl/library_js.js'),
'-sUSES_DYNAMIC_ALLOC', '-lwebgl.js',
'-lwebgl.js',
'-sMODULARIZE']
hello_webgl2_sources = hello_webgl_sources + ['-sMAX_WEBGL_VERSION=2']
hello_wasm_worker_sources = [test_file('wasm_worker/wasm_worker_code_size.c'), '-sWASM_WORKERS', '-sENVIRONMENT=web,worker']
Expand Down