From 42f94641509b3a1dd9b084cb4b7b50ba43d513e9 Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Patry Date: Mon, 25 Nov 2024 14:24:21 +0100 Subject: gccrs: Prepend crate name to functions with nr2 gcc/rust/ChangeLog: * backend/rust-compile-base.cc: Prepend crate name to function's ir name. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove passing tests from exclude list. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust/backend/rust-compile-base.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'gcc/rust') diff --git a/gcc/rust/backend/rust-compile-base.cc b/gcc/rust/backend/rust-compile-base.cc index 80ea7a4e..fb4aace 100644 --- a/gcc/rust/backend/rust-compile-base.cc +++ b/gcc/rust/backend/rust-compile-base.cc @@ -25,7 +25,8 @@ #include "rust-compile-type.h" #include "rust-constexpr.h" #include "rust-diagnostics.h" -#include "rust-expr.h" // for AST::AttrInputLiteral +#include "rust-expr.h" // for AST::AttrInputLiteral +#include "rust-hir-map.h" #include "rust-macro.h" // for AST::MetaNameValueStr #include "rust-hir-path-probe.h" #include "rust-type-util.h" @@ -39,6 +40,9 @@ #include "tree.h" #include "print-tree.h" +// rust-name-resolution-2.0 +#include "options.h" + namespace Rust { namespace Compile { @@ -667,6 +671,11 @@ HIRCompileBase::compile_function ( } std::string asm_name = fn_name; + auto &mappings = Analysis::Mappings::get (); + + if (flag_name_resolution_2_0) + ir_symbol_name = mappings.get_current_crate_name () + "::" + ir_symbol_name; + unsigned int flags = 0; tree fndecl = Backend::function (compiled_fn_type, ir_symbol_name, "" /* asm_name */, flags, locus); -- cgit v1.1