diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2021-11-19 23:20:56 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-19 23:20:56 +0300 |
commit | e750cb3ee50e958afa85d6642ba118c25844b262 (patch) | |
tree | 0ef29996b3b21a31844e7cde4064c60290dc04a8 | |
parent | b32801a63cff0561d2a327c71986ce05254c4d8b (diff) |
[aot] Prepend the assembly name to the names of gsharedvt wrappers to avoid duplicate symbol errors during static linking. (#21309)mono-6.12.0.161
Fixes https://github.com/mono/mono/issues/20417.
Co-authored-by: Zoltan Varga <vargaz@gmail.com>
-rw-r--r-- | mono/mini/aot-compiler.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/mono/mini/aot-compiler.c b/mono/mini/aot-compiler.c index b2dcabf154a..1ce73a79f9d 100644 --- a/mono/mini/aot-compiler.c +++ b/mono/mini/aot-compiler.c @@ -9073,8 +9073,18 @@ mono_aot_get_method_name (MonoCompile *cfg) /* Use the mangled name if possible */ if (method->wrapper_type == MONO_WRAPPER_OTHER) { WrapperInfo *info = mono_marshal_get_wrapper_info (method); - if (info->subtype == WRAPPER_SUBTYPE_GSHAREDVT_IN_SIG || info->subtype == WRAPPER_SUBTYPE_GSHAREDVT_OUT_SIG) - return mono_aot_get_mangled_method_name (method); + if (info->subtype == WRAPPER_SUBTYPE_GSHAREDVT_IN_SIG || info->subtype == WRAPPER_SUBTYPE_GSHAREDVT_OUT_SIG) { + char *name, *s; + name = mono_aot_get_mangled_method_name (method); + if (llvm_acfg->aot_opts.static_link) { + /* Include the assembly name too to avoid duplicate symbol errors */ + s = g_strdup_printf ("%s_%s", llvm_acfg->assembly_name_sym, name); + g_free (name); + return s; + } else { + return name; + } + } } if (llvm_acfg->aot_opts.static_link) |