From 9bcbfee5f3e7d69b59c985404b3e4e0788f4a607 Mon Sep 17 00:00:00 2001 From: Philip Herron Date: Fri, 14 May 2021 12:23:33 +0100 Subject: Add FNV-128 hash for legacy symbol mangling Rustc uses a SIP128 hash for the legacy symbol mangling but an FNV hash is simpler to implement this is a port of the implementation from golang stdlib hash package. The fingerprint for the hash is simple the function signiture for now. Rustc takes into account options such as -Cmetadata to generate uniqueness. We still need to implement an SIP128 and the V0 symbol mangling but this will do in the interim. Addresses: #305 Fixes: #428 --- gcc/rust/backend/rust-compile-implitem.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/rust/backend/rust-compile-implitem.h') diff --git a/gcc/rust/backend/rust-compile-implitem.h b/gcc/rust/backend/rust-compile-implitem.h index b071d94..a5ca13b 100644 --- a/gcc/rust/backend/rust-compile-implitem.h +++ b/gcc/rust/backend/rust-compile-implitem.h @@ -125,7 +125,7 @@ public: std::string fn_identifier = self->get_name () + "_" + function.get_function_name (); std::string asm_name - = ctx->mangle_impl_item (self, function.get_function_name ()); + = ctx->mangle_impl_item (self, fntype, function.get_function_name ()); Bfunction *fndecl = ctx->get_backend ()->function (compiled_fn_type, fn_identifier, @@ -310,7 +310,7 @@ public: std::string fn_identifier = self->get_name () + "_" + method.get_method_name (); std::string asm_name - = ctx->mangle_impl_item (self, method.get_method_name ()); + = ctx->mangle_impl_item (self, fntype, method.get_method_name ()); Bfunction *fndecl = ctx->get_backend ()->function (compiled_fn_type, fn_identifier, -- cgit v1.1