Skip to content

JSPI and dynamic linking messed up by stub trampoline #23395

@hoodmane

Description

@hoodmane

The dynamic linking code will generate a stub if it's not resolved when first imported:

          // Return a stub function that will resolve the symbol
          // when first called.
          if (!(prop in stubs)) {
            var resolved;
            stubs[prop] = (...args) => {
              resolved ||= resolveSymbol(prop);
              return resolved(...args);
            };
          }

https://github.com/emscripten-core/emscripten/blob/main/src/library_dylink.js?plain=1#L724-L727
This causes trouble when mixed with stack switching. Working around it will be a bit convoluted, but it should be possible with a little helper wasm module.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions