diff options
author | Philip Herron <philip.herron@embecosm.com> | 2021-05-14 12:23:33 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2021-05-14 12:34:24 +0100 |
commit | 9bcbfee5f3e7d69b59c985404b3e4e0788f4a607 (patch) | |
tree | 4ab3ce185bf03a191ad4241fc72a3c957066fa1d /gcc/rust/backend/rust-compile-item.h | |
parent | 5d7fbc4a78897f8f561bdd78b4d3bbc15f4b351f (diff) | |
download | gcc-9bcbfee5f3e7d69b59c985404b3e4e0788f4a607.zip gcc-9bcbfee5f3e7d69b59c985404b3e4e0788f4a607.tar.gz gcc-9bcbfee5f3e7d69b59c985404b3e4e0788f4a607.tar.bz2 |
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
Diffstat (limited to 'gcc/rust/backend/rust-compile-item.h')
-rw-r--r-- | gcc/rust/backend/rust-compile-item.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/rust/backend/rust-compile-item.h b/gcc/rust/backend/rust-compile-item.h index c3dc279..e3b6d0f 100644 --- a/gcc/rust/backend/rust-compile-item.h +++ b/gcc/rust/backend/rust-compile-item.h @@ -53,7 +53,7 @@ public: Bexpression *value = CompileExpr::Compile (var.get_expr (), ctx); std::string name = var.get_identifier (); - std::string asm_name = ctx->mangle_item (name); + std::string asm_name = ctx->mangle_item (resolved_type, name); bool is_external = false; bool is_hidden = false; @@ -154,7 +154,7 @@ public: // we don't mangle the main fn since we haven't implemented the main shim // yet if (!is_main_fn) - asm_name = ctx->mangle_item (ir_symbol_name); + asm_name = ctx->mangle_item (fntype, ir_symbol_name); Bfunction *fndecl = ctx->get_backend ()->function (compiled_fn_type, ir_symbol_name, |