Skip to content

Audit WebAssembly archives; wasm LibraryProducts are file products - #1463

Draft
pankgeorg wants to merge 1 commit into
JuliaPackaging:masterfrom
pankgeorg:wasm-target
Draft

pankgeorg wants to merge 1 commit into
JuliaPackaging:masterfrom
pankgeorg:wasm-target

Conversation

@pankgeorg

Copy link
Copy Markdown

What

  • audit_wasm runs for wasm platforms and checks:

    • every .a member is a wasm object;
    • its memory model matches the arch: memory64 in target_features exactly when the arch is wasm64;
    • constructors (init_funcs) are flagged;
    • .so files are flagged, since dylink.0 is not a stable ABI.

    It parses ar and the wasm sections directly, with no ObjectFile.jl change.

  • JLL wrappers for a wasm platform declare a LibraryProduct as a path (@declare_file_product/@init_file_product). An archive is never dlopened.

Why

Julia programs compiled to WebAssembly (e.g. with WasmCodegen.jl) link wasm archives from JLLs.

Today the audit passes vacuously on wasm. ObjectFile.jl can't read it, and only executables and .so/.dylib/.dll files are inspected. So a wasm32 archive shipped as wasm64, or a host object inside a wasm archive, goes unnoticed.

Depends on JuliaPackaging/BinaryBuilderBase.jl#509, for iswasm and the wasm LibraryProduct locating.

Precedent

The riscv64 rollout: #1355–#1368.

Tests run

test/wasm.jl passes 10/10 on Julia 1.13.2, with the Base and BinaryBuilderBase changes. It runs against real PCRE2 10.46 archives from JuliaPackaging/Yggdrasil#15468, given in WASM_ARCHIVES. It checks:

  • the members of both archives are found;
  • the memory model is detected;
  • there are no constructors;
  • each archive passes for its own platform and fails for the other;
  • a member that isn't wasm fails.

It skips without the archives. The rest of the suite was not run locally.

Open questions

  • Static linking needs the link order and transitive dependencies of archives, which shared libraries hid. Should BinaryBuilder record them, or should consumers derive them from JLL dependencies?
  • Should the audit also link each archive against wasi-libc and check that nothing unexpected is undefined? That needs the PlatformSupport shard in the audit environment.

🤖 Generated with Claude Code

The ELF/Mach-O/PE audit cannot read wasm and passed vacuously. Check that
each archive member is a wasm object of the platform's memory model, and
flag shared libraries and constructors. On wasm platforms the wrapper
declares a library product as a path: there is nothing to dlopen().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant