See https://github.com/emscripten-core/emscripten/pull/19780 (cherry picked from commit 042243471f)
042243471f