This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Refactor rust-demangle to be independent of C++ demangling.


On Tue, Oct 22, 2019 at 11:08 AM Eduard-Mihai Burtescu <eddyb@lyken.rs> wrote:
>

> @@ -160,27 +159,20 @@ cplus_demangle (const char *mangled, int options)
>    if ((options & DMGL_STYLE_MASK) == 0)
>      options |= (int) current_demangling_style & DMGL_STYLE_MASK;
>
> +  /* The Rust demangling is implemented elsewhere.
> +     Legacy Rust symbols overlap with GNU_V3, so try Rust first.  */
> +  if (RUST_DEMANGLING || AUTO_DEMANGLING)
> +    {
> +      ret = rust_demangle (mangled, options);
> +      if (ret || RUST_DEMANGLING)
> +        return ret;
> +    }
> +
>    /* The V3 ABI demangling is implemented elsewhere.  */
> -  if (GNU_V3_DEMANGLING || RUST_DEMANGLING || AUTO_DEMANGLING)
> +  if (GNU_V3_DEMANGLING || AUTO_DEMANGLING)
>      {
>        ret = cplus_demangle_v3 (mangled, options);
> -      if (GNU_V3_DEMANGLING)
> -       return ret;
> -
> -      if (ret)
> -       {
> -         /* Rust symbols are GNU_V3 mangled plus some extra subtitutions.
> -            The subtitutions are always smaller, so do in place changes.  */
> -         if (rust_is_mangled (ret))
> -           rust_demangle_sym (ret);
> -         else if (RUST_DEMANGLING)
> -           {
> -             free (ret);
> -             ret = NULL;
> -           }
> -       }
> -
> -      if (ret || RUST_DEMANGLING)
> +      if (ret || GNU_V3_DEMANGLING)
>         return ret;
>      }


I have to assume that C++ demangling is still quite a bit more common
than Rust demangling, so it's troubling that it looks like we're going
to do extra work for each symbol that starts with _ZN, which is not a
particularly uncommon prefix for a C++ mangled name.  Is there some
way we can quickly separate out Rust symbols?  Or should we try C++
demangling first?

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]