Re: [PATCH 04/13] Kbuild: Rust support

From: Miguel Ojeda
Date: Mon Apr 19 2021 - 17:03:44 EST


On Mon, Apr 19, 2021 at 10:18 PM Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:
>
> Yes, I agree, we need a better story for name mangling.
> My proposal is that we store a pretty name which matches the source
> (eg rust_binder::range_alloc) and a sha1 of the mangled symbol
> (40 bytes of uninteresting hex). Symbol resolution is performed against
> the sha1. Printing is of the pretty name. It should be obvious from
> the stack trace which variant of a function is being called, no?

If the pretty name is only `rust_binder::range_alloc`, that would not
be enough, since (in this case) that is a module name (i.e. the
namespace of the `DescriptorState` type). The function being called
here is `fmt` (the one outside the `<>`), which is a method of the
`Debug` trait.

We could perhaps reduce this down to:

rust_binder::range_alloc::DescriptorState::fmt

without much ambiguity (in most cases).

Cheers,
Miguel