Skip to content

Add an API to detect precompiled modules/components#6832

Merged
alexcrichton merged 1 commit into
bytecodealliance:mainfrom
alexcrichton:detect-precompiled
Aug 10, 2023
Merged

Add an API to detect precompiled modules/components#6832
alexcrichton merged 1 commit into
bytecodealliance:mainfrom
alexcrichton:detect-precompiled

Conversation

@alexcrichton
Copy link
Copy Markdown
Member

This commit adds a new Engine::detect_precompiled API to inspect some bytes and determine if they look like a precompiled artifact of either a core wasm module or component. This is something I'll be using soon in an upcoming refactor of the Wasmtime CLI to support components, but it's something we've also talked about before which can be useful for systems storing both precompiled modules and components.

Implementation-wise this looks at the ELF header of the input and determines if it's got all the right flags that Wasmtime sets for the various bits and bobs of our object format.

This commit adds a new `Engine::detect_precompiled` API to inspect some
bytes and determine if they look like a precompiled artifact of either a
core wasm module or component. This is something I'll be using soon in
an upcoming refactor of the Wasmtime CLI to support components, but it's
something we've also talked about before which can be useful for systems
storing both precompiled modules and components.

Implementation-wise this looks at the ELF header of the input and
determines if it's got all the right flags that Wasmtime sets for the
various bits and bobs of our object format.
@alexcrichton alexcrichton requested a review from a team as a code owner August 10, 2023 18:09
@alexcrichton alexcrichton requested review from pchickey and removed request for a team August 10, 2023 18:09
@alexcrichton alexcrichton added this pull request to the merge queue Aug 10, 2023
Merged via the queue into bytecodealliance:main with commit 137c6f6 Aug 10, 2023
@alexcrichton alexcrichton deleted the detect-precompiled branch August 10, 2023 21:01
eduardomourar pushed a commit to eduardomourar/wasmtime that referenced this pull request Aug 18, 2023
…#6832)

This commit adds a new `Engine::detect_precompiled` API to inspect some
bytes and determine if they look like a precompiled artifact of either a
core wasm module or component. This is something I'll be using soon in
an upcoming refactor of the Wasmtime CLI to support components, but it's
something we've also talked about before which can be useful for systems
storing both precompiled modules and components.

Implementation-wise this looks at the ELF header of the input and
determines if it's got all the right flags that Wasmtime sets for the
various bits and bobs of our object format.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants