Skip to content
Snippets Groups Projects
Commit cb60da24 authored by Cheng Shao's avatar Cheng Shao Committed by Marge Bot
Browse files

wasm: fix dyld for shared libraries created by llvm 20.x

This patch fixes wasm dyld script for shared libraries created by llvm
20.x. The __wasm_apply_data_relocs function is now optional and may be
omitted for shared libraries without any runtime relocatable data
segments, so only call __wasm_apply_data_relocs when it's present.
parent fbf3d020
No related branches found
No related tags found
No related merge requests found
......@@ -796,12 +796,17 @@ class DyLD {
const init = () => {
// See
// https://github.com/llvm/llvm-project/blob/llvmorg-19.1.1/lld/wasm/Writer.cpp#L1430,
// there's also __wasm_init_memory (not relevant yet, we don't
// https://gitlab.haskell.org/haskell-wasm/llvm-project/-/blob/release/20.x/lld/wasm/Writer.cpp#L1450,
// __wasm_apply_data_relocs is now optional so only call it if
// it exists (we know for sure it exists for libc.so though).
// There's also __wasm_init_memory (not relevant yet, we don't
// use passive segments) & __wasm_apply_global_relocs but
// those are included in the start function and should have
// been called upon instantiation.
instance.exports.__wasm_apply_data_relocs();
// been called upon instantiation, see
// Writer::createStartFunction().
if (instance.exports.__wasm_apply_data_relocs) {
instance.exports.__wasm_apply_data_relocs();
}
instance.exports._initialize();
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment