-
Notifications
You must be signed in to change notification settings - Fork 831
Description
I discovered a couple of things while working on some unrelated stuff (enabling bulk memory and nontrapping-fp by default).
While doing that I wrote #7043 to make testing on the emscripten side easier and to make the current default behavior consistent with what will be the default when we enable bigint by default (and thus stop running wasm-emscripten-finalize by default). Namely, linked binaries will contain target_feature sections by default.
I discovered that the presence of that section affects the behavior of module splitting (and probably beyond): features.hasReferenceTypes() and friends now returns true, since LLVM is now enabling reference types. This somewhat weird by itself, since the presence of the section is what controls this, and not whether e.g. there are actually multiple tables (or exnref etc) or flag/configuration, and because emscripten has historically stripped that section most (but not all!) of the time. Probably we should do something about that, but I'm not 100% sure what; maybe if the feature section is missing, we could set those feature flags when we encounter module properties that imply them? or maybe fall back to which features are enabled on the command line? maybe that will depend on the particular use of features.hasFoo(), I'm not sure how pervasive those uses are but if they are common it seems like we should maybe be more robust.
But more to the immediate point, #7043 also caused the roll into emscripten to fail because emscripten's use of module splitting doesn't seem to support multiple tables (there is a JS loading failure I haven't exactly diagnosed yet). I think this is also going to block enabling the features by default, so we will either need to fix emscripten's loading JS, or make a way for emscripten to disable multiple tables for now, so we can separate the problem of feature enablement from updating for multiple tables.