Skip to content

Completely remove REVERSE_DEPS / deps_info using new wasm-ld feature #18875

@sbc100

Description

@sbc100

Today in emscripten we have a reverse dependency system that is made up of two main parts:

  1. Explicitly dependency info in deps_info.py and __deps entries in library files.
  2. Scanning of all inputs using llvm-nm do discover which deps are needed.

With #18849 having been merged we can now move the deps information out of deps_info.py and into the library files.

I was planning on land that next phase, #18865, which enables transitive dependencies, but unfortunately that cause a regression because the current error message produced by wasm-ld was less useful than the jsifier ones:

Current wasm-ld error for missing reverse deps:

wasm-ld: error: symbol exported via --export not found: foo

vs:

error: undefined symbol: bar (referenced by foo__deps: ['bar'], referenced by emscripten_runtime_keepalive_pop__deps: ['foo','$runtimeKeepalivePop'], referenced by top-level compiled C/C++ code)

I think if we can make the wasm-ld message more like this then we could finally switch over to wasm-ld for all symbol resolution:

wasm-ld: error: undefined symbols `foo` required by `bar` which was imported from `libemscripten.txt`

This will require a new wasm-ld input format, which is kind of like a dummy shared library, but is essentially just a text file representing external symbol and their dependencies. My plan is to use a format much like the current current format we use for our cached symbol lists. e.g.:

js_sym
js_sym_foo: malloc, free

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions