Skip to content

port(wasm): Support --export of linker-defined symbols - #2414

Open
lapla-cogito wants to merge 3 commits into
wild-linker:mainfrom
lapla-cogito:export_synthesized
Open

port(wasm): Support --export of linker-defined symbols#2414
lapla-cogito wants to merge 3 commits into
wild-linker:mainfrom
lapla-cogito:export_synthesized

Conversation

@lapla-cogito

Copy link
Copy Markdown
Member

Look up linker-synthesized symbols for --export / --export-if-defined and materialize them.

Fixes #2334
Part of #1431

Comment thread libwild/src/wasm.rs Outdated
continue;
}
match sym {
WasmLinkerSymbol::CallCtors => needs_ctors = true,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this repeating logic that already exists elsewhere? Any idea how to deduplicate?

Comment thread libwild/src/wasm.rs Outdated
let global = layout.globals.get_mut(defined_slot).ok_or_else(|| {
crate::error!("exported data global slot {defined_slot} out of range")
})?;
let addr_i32 = i32::try_from(addr).map_err(|_| {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are addresses encoded as i32 rather than u32? Seems surprising. Could it ever make sense for a negative value?

Comment thread libwild/src/wasm.rs
fn requested_linker_export_symbols(args: &WasmArgs) -> Vec<WasmLinkerSymbol> {
let mut symbols = Vec::new();
for name in args.force_export_symbol_names() {
let Some(sym) = WasmLinkerSymbol::parse(name) else {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems odd to me that we're parsing the symbol name both here and in ensure_force_exports. Do we need to do both?

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.

Wasm: --export not found: __wasm_call_ctors

2 participants