Bug 2233269 - perf 6.4.4-200.fc38 unable to demangle Rust symbols
Summary: perf 6.4.4-200.fc38 unable to demangle Rust symbols
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel-tools
Version: 38
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Justin M. Forbes
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-08-21 19:39 UTC by mail+redhat
Modified: 2024-05-28 13:51 UTC (History)
9 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2024-05-28 13:51:50 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Gitlab cki-project kernel-ark merge_requests 2921 0 None opened spec: Set EXTRA_CXXFLAGS for perf demangle-cxx.o 2024-02-02 19:21:40 UTC

Description mail+redhat 2023-08-21 19:39:01 UTC
perf version 6.4.4-200.fc38 is unable to demangle Rust symbols. This is a regression from version 6.2.6-300.fc38 which did so without issue.

Reproducible: Always

Steps to Reproduce:
1. Install perf-6.4.4-200.fc38
2. Profile Rust code via `perf record some_rust_executable` (compliled with debug information)
3. View report via `perf report`

Actual Results:  
Rust symbols are not demangled.

Expected Results:  
Demangled rust symbols.

Before tracking the issue down to perf, I created an issue with a flamegraph tool for Rust. You can see some screen shots of the mangled symbols there: https://github.com/flamegraph-rs/flamegraph/issues/280

Comment 1 mail+redhat 2023-10-13 19:44:49 UTC
The issue is still present with 6.5.4-200.fc38.

Comment 2 Michael Clayton 2024-01-05 20:11:30 UTC
This issue is sitll present in perf-6.6.3-200.fc39.

Comment 3 Josh Stone 2024-02-02 00:01:09 UTC
Perf does rust demangling after an initial C++ demangling pass, but it was broken in Fedora by the following commit:

commit 65cd8e5534f873b76b55fb17e942c512ee3699d9 (tags/v6.4-rc5~38^2~4)
Author: Ian Rogers <irogers>
Date:   Mon Apr 17 12:25:46 2023 -0700

    perf build: Don't compile demangle-cxx.cpp if not necessary
    
    demangle-cxx.cpp requires a C++ compiler, but feature checks may fail
    because of the absence of this. Add a CONFIG_CXX_DEMANGLE so that the
    source isn't built if not supported. Copy libbfd and cplus demangle
    variants to a weak symbol-elf.c version so they aren't dependent on
    C++. These variants are only built with the build option
    BUILD_NONDISTRO=1.
    
    Committer note:
    
    This also handles this build break when a C++ compiler isn't available:
    
      CXX     /tmp/build/perf/util/demangle-cxx.o
      /bin/sh: g++: command not found
    
    Signed-off-by: Ian Rogers <irogers>
    Tested-by: Arnaldo Carvalho de Melo <acme>
    Cc: Adrian Hunter <adrian.hunter>
    Cc: Alexander Shishkin <alexander.shishkin.com>
    Cc: Ingo Molnar <mingo>
    Cc: Jiri Olsa <jolsa>
    Cc: Leo Yan <leo.yan>
    Cc: Mark Rutland <mark.rutland>
    Cc: Namhyung Kim <namhyung>
    Cc: Peter Zijlstra <peterz>
    Cc: Qi Liu <liuqi115>
    Cc: Ravi Bangoria <ravi.bangoria>
    Link: https://lore.kernel.org/r/20230417192546.99923-1-irogers@google.com
    Signed-off-by: Arnaldo Carvalho de Melo <acme>

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=65cd8e5534f873b76b55fb17e942c512ee3699d9

From that v6.4-rc5~38^2~4, we can see in the build logs that it matches when demangle-cxx.o was lost:

* good in kernel-tools-6.4.0-0.rc3.git0.1.fc39 https://koji.fedoraproject.org/koji/buildinfo?buildID=2204192
  - (rc4 was not built)
* missing in kernel-tools-6.4.0-0.rc5.git0.1.fc39 https://koji.fedoraproject.org/koji/buildinfo?buildID=2209309

I haven't yet determined what the feature detection is looking for -- the build *does* have gcc-c++ and libstdc++-devel available though.

Comment 4 Josh Stone 2024-02-02 00:26:42 UTC
The feature test is failing like so during the rpm build:

# cat tools/build/feature/test-cxa-demangle.make.output
/usr/bin/ld: /tmp/ccybKwcM.o: relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status

Comment 5 Josh Stone 2024-02-02 01:59:53 UTC
It works when I set EXTRA_CXXFLAGS="${RPM_OPT_FLAGS}" in the perf build. I will submit a PR for that soon.

Comment 6 Aoife Moloney 2024-05-28 13:51:50 UTC
Fedora Linux 38 entered end-of-life (EOL) status on 2024-05-21.

Fedora Linux 38 is no longer maintained, which means that it
will not receive any further security or bug fix updates. As a result we
are closing this bug.

If you can reproduce this bug against a currently maintained version of Fedora Linux
please feel free to reopen this bug against that version. Note that the version
field may be hidden. Click the "Show advanced fields" button if you do not see
the version field.

If you are unable to reopen this bug, please file a new report against an
active release.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.