https://bugs.kde.org/show_bug.cgi?id=445184

            Bug ID: 445184
           Summary: Rust v0 symbol demangling is broken
           Product: valgrind
           Version: unspecified
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: jsew...@acm.org
          Reporter: n.netherc...@gmail.com
  Target Milestone: ---

Created attachment 143357
  --> https://bugs.kde.org/attachment.cgi?id=143357&action=edit
Fix Rust v0 demangling.

Rust has an old symbol mangling scheme ("legacy") and a new scheme ("v0"). The
tracking issue for switching to the new scheme is at
https://github.com/rust-lang/rust/issues/60705.

Valgrind has supported the legacy scheme for a long time. Bug #431306 added
code to support the v0 scheme, which was released in 3.18. Unfortunately, due
to an erroneous condition in the outer layer of the demangling code, the v0
demangling code is never reached. C++ and legacy symbols start with "_Z", but
v0 symbols start with "_R", and this erroneous condition only checks for the
former.

It's possible that this wasn't noticed because the Rust compiler is still using
legacy mangling; you need to run with `-Z symbol-mangling-version=v0` to enable
v0 mangling.

The attachment fixes the problem and adds a test. I have confirmed that the
test fails without the fix -- because the one legacy symbol is demangled
correctly, but the two v0 symbols are not. I have also confirmed the validity
of the fix by doing large scale profiling of the Rust compiler, which is using
v0 symbols internally.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to