diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-05-11 17:46:10 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-11 17:46:10 +0000 |
commit | 5134aaa9f0b37ea372cb185fe7aa6c26fe0a4c2e (patch) | |
tree | 95c03868e9d05a84000e29187e2e5ccba431cd35 /gcc/rust/backend/rust-compile-implitem.h | |
parent | 299d98d8e6fcb8d014b299adc426d93cf0c8050f (diff) | |
parent | 58e108c7c6d0fa3c9ebc7eeb681851924e22ddd5 (diff) | |
download | gcc-5134aaa9f0b37ea372cb185fe7aa6c26fe0a4c2e.zip gcc-5134aaa9f0b37ea372cb185fe7aa6c26fe0a4c2e.tar.gz gcc-5134aaa9f0b37ea372cb185fe7aa6c26fe0a4c2e.tar.bz2 |
Merge #425
425: Basic implementation of legacy symbol mangling r=philberty a=philberty
Implement basic rustc legacy symbol mangling
Rust supports two different symbol mangling methods legacy and V0. V0 is
the goal but its not yet stable. This implements the legacy method but
with a dummy hash value since it requires a sip128 implementation to
generate the apropriate hash which can be done in a sperate change.
This change allows us to actually assemble generic functions and avoid
bad symbol duplications.
Addresses #305
Co-authored-by: Philip Herron <philip.herron@embecosm.com>
Diffstat (limited to 'gcc/rust/backend/rust-compile-implitem.h')
-rw-r--r-- | gcc/rust/backend/rust-compile-implitem.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/gcc/rust/backend/rust-compile-implitem.h b/gcc/rust/backend/rust-compile-implitem.h index cee3a3b..f2caa2e 100644 --- a/gcc/rust/backend/rust-compile-implitem.h +++ b/gcc/rust/backend/rust-compile-implitem.h @@ -112,15 +112,17 @@ public: ::Btype *compiled_fn_type = TyTyResolveCompile::compile (ctx, fntype); unsigned int flags = 0; - std::string fn_identifier - = self->get_name () + "_" + function.get_function_name (); // if its the main fn or pub visibility mark its as DECL_PUBLIC // please see https://github.com/Rust-GCC/gccrs/pull/137 if (function.has_visibility ()) flags |= Backend::function_is_visible; - std::string asm_name = fn_identifier; + std::string fn_identifier + = self->get_name () + "_" + function.get_function_name (); + std::string asm_name + = ctx->mangle_impl_item (self, function.get_function_name ()); + Bfunction *fndecl = ctx->get_backend ()->function (compiled_fn_type, fn_identifier, asm_name, flags, function.get_locus ()); @@ -291,15 +293,17 @@ public: ::Btype *compiled_fn_type = TyTyResolveCompile::compile (ctx, fntype); unsigned int flags = 0; - std::string fn_identifier - = self->get_name () + "_" + method.get_method_name (); // if its the main fn or pub visibility mark its as DECL_PUBLIC // please see https://github.com/Rust-GCC/gccrs/pull/137 if (method.has_visibility ()) flags |= Backend::function_is_visible; - std::string asm_name = fn_identifier; + std::string fn_identifier + = self->get_name () + "_" + method.get_method_name (); + std::string asm_name + = ctx->mangle_impl_item (self, method.get_method_name ()); + Bfunction *fndecl = ctx->get_backend ()->function (compiled_fn_type, fn_identifier, asm_name, flags, method.get_locus ()); |