Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests failing with the stable-x86_64-pc-windows-gnu toolchain. #29

Open
plusvic opened this issue May 18, 2023 · 1 comment
Open

Tests failing with the stable-x86_64-pc-windows-gnu toolchain. #29

plusvic opened this issue May 18, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@plusvic
Copy link
Member

plusvic commented May 18, 2023

The tests fail with the stable-x86_64-pc-windows-gnu toolchain, apparently because of some issue with the linkme crate. It works with stable-x86_64-pc-windows-msvc, though.

The linkme crate is used for creating the static slice wasm::WASM_EXPORTS , which contains an entry for every function that can be called from WASM. This includes functions decorated with the #[wasm_export] and #[module_export] attributes, which ultimately result in the use of the #[distributed_slice] attribute provided by linkme. Example:

#[distributed_slice(WASM_EXPORTS)]
pub(crate) static export__add: WasmExport = WasmExport {
     name: "add",
     mangled_name: "add@ii@i",
     rust_module_path: "yara_x::modules::my_module",
     func: &WasmExportedFn2 { target_fn: &add },
     public: true,
};

For some reason, when using the stable-x86_64-pc-windows-gnu toolchain, not all functions are added to the wasm::WASM_EXPORTS slice, only the ones declared in the yara-x/src/wasm/mod.rs file are added. All other functions, specifically those declared in modules are not added at all. The compilation process works well, but tests fail due to the missing entries in wasm::WASM_EXPORTS.

@plusvic plusvic added the bug Something isn't working label May 18, 2023
@plusvic
Copy link
Member Author

plusvic commented May 18, 2023

Possibly related: dtolnay/linkme#25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant