From 30dee162c365f9eea2a425b1bf5c29897dd805cd Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Wed, 2 Aug 2023 21:50:32 +0900 Subject: [PATCH] libdyld: call _initialize as well --- libdyld/dyld.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libdyld/dyld.c b/libdyld/dyld.c index f3ad33cc..fa8fa80d 100644 --- a/libdyld/dyld.c +++ b/libdyld/dyld.c @@ -66,7 +66,17 @@ static const struct name name_main_object = NAME_FROM_CSTR_LITERAL("
"); */ static const struct name init_funcs[] = { NAME_FROM_CSTR_LITERAL("__wasm_apply_data_relocs"), + /* + * wasm-ld synthesize __wasm_call_ctors. + * + * if crt1 is linked to the library, _initialize calls + * __wasm_call_ctors. in that case, usually __wasm_call_ctors + * is not exported. + * + * otherwise, wasm-ld exports __wasm_call_ctors. + */ NAME_FROM_CSTR_LITERAL("__wasm_call_ctors"), + NAME_FROM_CSTR_LITERAL("_initialize"), }; static const struct val val_null = {