#1108037 linux-perf: perf report --demangle only works on some(?) symbols

Package:
linux-perf
Source:
linux-perf
Description:
Performance analysis tools for Linux
Submitter:
наб
Date:
2025-09-18 03:31:02 UTC
Severity:
normal
Tags:
#1108037#5
Date:
2025-06-19 14:09:24 UTC
From:
To:
Dear Maintainer,

I'm attaching a tarball that, when extracted in the home directory,
should demonstrate the issue.

Running perf report -g --demangle shows
  Samples: 278K of event 'cycles:u', Event count (approx.): 183133005676
    Children      Self  Command  Shared Object         Symbol
  +   98.44%     0.00%  bench    bench                 [.] main
  +   89.76%     0.00%  bench    bench                 [.] _ZN5Botan11Cipher_Mode6updateITkNS_8concepts21resizable_byte_bufferESt6vectorIhNS_16secure_allocatorIhEEEEEvRT_m
  +   89.76%     0.00%  bench    bench                 [.] Botan::Cipher_Mode::process(std::span<unsigned char, 18446744073709551615ul>)
  +   54.86%     0.00%  bench    bench                 [.] Botan::CBC_Encryption::finish_msg(std::vector<unsigned char, Botan::secure_allocator<unsigned char> >&, unsigned lo
  +   46.47%     0.16%  bench    bench                 [.] Botan::CBC_Encryption::process_msg(unsigned char*, unsigned long)
  +   43.29%     0.00%  bench    bench                 [.] Botan::CBC_Decryption::finish_msg(std::vector<unsigned char, Botan::secure_allocator<unsigned char> >&, unsigned lo
  +   43.28%     0.19%  bench    bench                 [.] Botan::CBC_Decryption::process_msg(unsigned char*, unsigned long)
  +   40.66%     0.07%  bench    bench                 [.] Botan::BlockCipher::encrypt(unsigned char*) const
  +   40.61%     2.70%  bench    bench                 [.] Botan::Twofish::encrypt_n(unsigned char const*, unsigned char*, unsigned long) const
  +   40.35%     0.00%  bench    [unknown]             [k] 0000000000000000
  +   38.64%     2.30%  bench    bench                 [.] Botan::Twofish::decrypt_n(unsigned char const*, unsigned char*, unsigned long) const
  +   21.28%    12.28%  bench    bench                 [.] Botan::(anonymous namespace)::TF_E(unsigned int, unsigned int, unsigned int&, unsigned int&, unsigned int, unsigned
  +   20.93%    12.36%  bench    bench                 [.] Botan::(anonymous namespace)::TF_D(unsigned int, unsigned int, unsigned int&, unsigned int&, unsigned int, unsigned
  +   14.96%    11.71%  bench    bench                 [.] std::vector<unsigned int, Botan::secure_allocator<unsigned int> >::operator[](unsigned long) const
  +    9.29%     0.15%  bench    bench                 [.] Botan::xor_buf(unsigned char*, unsigned char const*, unsigned long)
  +    8.39%     0.00%  bench    bench                 [.] Botan::PKCS7_Padding::add_padding(std::vector<unsigned char, Botan::secure_allocator<unsigned char> >&, unsigned lo
  +    8.39%     0.00%  bench    bench                 [.] std::vector<unsigned char, Botan::secure_allocator<unsigned char> >::resize(unsigned long)
  +    8.39%     0.00%  bench    bench                 [.] std::vector<unsigned char, Botan::secure_allocator<unsigned char> >::_M_default_append(unsigned long)
  +    8.33%     0.00%  bench    bench                 [.] std::vector<unsigned char, Botan::secure_allocator<unsigned char> >::_S_relocate(unsigned char*, unsigned char*, un
  +    8.33%     0.00%  bench    bench                 [.] unsigned char* std::__relocate_a<unsigned char*, unsigned char*, Botan::secure_allocator<unsigned char> >(unsigned
  +    8.33%     0.90%  bench    bench                 [.] unsigned char* std::__relocate_a_1<unsigned char*, unsigned char*, Botan::secure_allocator<unsigned char> >(unsigne
  +    8.19%     3.06%  bench    bench                 [.] _ZN5Botan7xor_bufITkNS_6ranges23contiguous_output_rangeIhEESt4spanIhLm18446744073709551615EETkNS1_16contiguous_rang
  +    7.56%     1.01%  bench    bench                 [.] void std::__relocate_object_a<unsigned char, unsigned char, Botan::secure_allocator<unsigned char> >(unsigned char*
  +    7.34%     0.04%  bench    bench                 [.] auto Botan::load_le<Botan::detail::AutoDetect, unsigned char const*&, unsigned int&, unsigned int&, unsigned int&,
  +    7.29%     0.07%  bench    bench                 [.] _ZN5Botan6detail8load_anyILNS0_10EndiannessE1ENS0_10AutoDetectETpTkNS0_20unsigned_integralishEJjjjjEQaaaagtsZT1_Li0
  +    7.25%     0.05%  bench    bench                 [.] auto Botan::load_le<Botan::detail::AutoDetect, unsigned char const*&, unsigned int&, unsigned int&, unsigned int&,
  +    7.20%     0.06%  bench    bench                 [.] _ZN5Botan6detail8load_anyILNS0_10EndiannessE1ENS0_10AutoDetectETpTkNS0_20unsigned_integralishEJjjjjjjjjEQaaaagtsZT1
  +    7.18%     0.05%  bench    bench                 [.] auto Botan::store_le<Botan::detail::AutoDetect, unsigned char*&, unsigned int&, unsigned int&, unsigned int&, unsig
  +    7.13%     0.07%  bench    bench                 [.] _ZN5Botan6detail9store_anyILNS0_10EndiannessE1ENS0_10AutoDetectETkNS0_20unsigned_integralishEjTpTkNS0_20unsigned_in
  +    7.11%     0.39%  bench    bench                 [.] _ZN5Botan6detail8load_anyILNS0_10EndiannessE1ETkNS0_20unsigned_integralishEjTkNS_6ranges16contiguous_rangeIhEESt4sp
  +    7.02%     0.26%  bench    bench                 [.] _ZN5Botan6detail8load_anyILNS0_10EndiannessE1ENS0_10AutoDetectETkNS_6ranges16contiguous_rangeIhEESt4spanIKhLm16EETp
  +    7.01%     0.18%  bench    bench                 [.] _ZN5Botan6detail8load_anyILNS0_10EndiannessE1ENS0_10AutoDetectETkNS_6ranges16contiguous_rangeIhEESt4spanIKhLm32EETp
  +    6.88%     0.21%  bench    bench                 [.] _ZN5Botan6detail9store_anyILNS0_10EndiannessE1EjTkNS_6ranges23contiguous_output_rangeIhEESt4spanIhLm16EETpTkNS0_20u
  +    6.82%     0.42%  bench    bench                 [.] _ZZN5Botan6detail8load_anyILNS0_10EndiannessE1ENS0_10AutoDetectETkNS_6ranges16contiguous_rangeIhEESt4spanIKhLm32EET
  +    6.71%     0.40%  bench    bench                 [.] _ZZN5Botan6detail8load_anyILNS0_10EndiannessE1ENS0_10AutoDetectETkNS_6ranges16contiguous_rangeIhEESt4spanIKhLm16EET
  +    6.66%     0.07%  bench    bench                 [.] auto Botan::store_le<Botan::detail::AutoDetect, unsigned char*&, unsigned int&, unsigned int&, unsigned int&, unsig
  +    6.60%     0.32%  bench    bench                 [.] _ZZN5Botan6detail9store_anyILNS0_10EndiannessE1EjTkNS_6ranges23contiguous_output_rangeIhEESt4spanIhLm16EETpTkNS0_20
  +    6.60%     0.05%  bench    bench                 [.] _ZN5Botan6detail9store_anyILNS0_10EndiannessE1ENS0_10AutoDetectETkNS0_20unsigned_integralishEjTpTkNS0_20unsigned_in
  +    6.57%     0.41%  bench    bench                 [.] _ZN5Botan6detail9store_anyILNS0_10EndiannessE1ETkNS0_20unsigned_integralishEjTkNS_6ranges23contiguous_output_rangeI
  +    6.47%     0.23%  bench    bench                 [.] _ZN5Botan6detail9store_anyILNS0_10EndiannessE1EjTkNS_6ranges23contiguous_output_rangeIhEESt4spanIhLm32EETpTkNS0_20u
  +    6.28%     0.25%  bench    bench                 [.] _ZZN5Botan6detail8load_anyILNS0_10EndiannessE1ETkNS0_20unsigned_integralishEjTkNS_6ranges16contiguous_rangeIhEESt4s
  +    6.20%     0.30%  bench    bench                 [.] _ZZN5Botan6detail9store_anyILNS0_10EndiannessE1EjTkNS_6ranges23contiguous_output_rangeIhEESt4spanIhLm32EETpTkNS0_20
  +    6.03%     0.30%  bench    bench                 [.] _ZN5Botan13typecast_copyIjTkNS_6ranges16contiguous_rangeERSt4spanIKhLm4EEQaaaasr3stdE26is_default_constructible_vIT
  +    5.78%     0.36%  bench    bench                 [.] _ZN5Botan13typecast_copyIjTkNS_6ranges16contiguous_rangeERSt4spanIKhLm4EEQaaaasr3stdE23is_trivially_copyable_vINSt8
  +    5.64%     0.38%  bench    bench                 [.] _ZN5Botan13typecast_copyITkNS_6ranges23contiguous_output_rangeERSt4spanIhLm4EEjQaaaasr3stdE23is_trivially_copyable_
  +    4.40%     0.00%  bench    [unknown]             [k] 0x7e7e5a48fcfcb490
  +    3.88%     0.91%  bench    bench                 [.] decltype (_S_construct({parm#1}, {parm#2}, (std::forward<unsigned char>)({parm#3}))) std::allocator_traits<Botan::s
  +    3.69%     0.65%  bench    bench                 [.] _ZN5Botan13typecast_copyITkNS_6ranges23contiguous_output_rangeERSt4spanIhLm4EETkNS1_16contiguous_rangeES2_IKjLm1EEQ
  +    3.68%     0.70%  bench    bench                 [.] _ZN5Botan13typecast_copyITkNS_6ranges23contiguous_output_rangeESt4spanIjLm1EETkNS1_16contiguous_rangeERS2_IKhLm4EEQ
  +    2.98%     0.90%  bench    bench                 [.] std::enable_if<__and_<std::__and_<std::__not_<std::allocator_traits<Botan::secure_allocator<unsigned char> >::__con
  +    2.79%     0.78%  bench    bench                 [.] void std::allocator_traits<Botan::secure_allocator<unsigned char> >::destroy<unsigned char>(Botan::secure_allocator
  Cannot load tips.txt file, please install perf!
and obviously many of these have not been demangled.

Best,

#1108037#10
Date:
2025-06-19 14:13:47 UTC
From:
To:
Please see https://lfs.nabijaczleweli.xyz/0027-b.d.o-1108037/perf.tar.zst instead of attachment.
#1108037#21
Date:
2025-07-09 16:15:10 UTC
From:
To:
Control: tag -1 moreinfo
[...]

None of bfd_demangle() from libbfd, cplus_demangle() from libiberty,
abi::__cxx_demangle() from libstdc++ are able to demangle this symbol.
(We currently configure perf to use abi::__cxx_demangle.)

The llvm-cxxfilt command demangles it to "void
Botan::Cipher_Mode::update<std::vector<unsigned char,
Botan::secure_allocator<unsigned char>>>(std::vector<unsigned char,
Botan::secure_allocator<unsigned char>>&, unsigned long)" but it seems
to be ignoring part of the symbol, specifically
"Botan::concepts::resizable_byte_buffer".

If I delete the "Tk" from the mangled symbol then they all agree it
should be demangled to "void
Botan::Cipher_Mode::update<std::vector<unsigned char,
Botan::secure_allocator<unsigned char>>>(std::vector<unsigned char,
Botan::secure_allocator<unsigned char>>&, unsigned long)".

What does the actual declaration of this function look like, and what
toolchain are you using to compile it?

Ben.

#1108037#28
Date:
2025-07-09 17:16:36 UTC
From:
To:
Control: tag -1 - moreinfo

I get this out of src:botan3 3.7.1+dfsg-2 src/lib/modes/cbc/cbc.cpp
when building with clang trunk (21.0.0 (++20250519112653+d0ee35851bb9-1~exp1~20250519112844.1459))
                               (from http://apt.llvm.org/bookworm/)
when configuring as ./configure.py --minimized-build --enable-modules cbc,twofish
then building with make build/obj/lib/modes_cbc.o

The construction looks like
  class secure_allocator { /* ... */ };
  using secure_vector = std::vector<T, secure_allocator<T>>;

  class BOTAN_PUBLIC_API(2, 0) Cipher_Mode : public SymmetricAlgorithm {
    template <concepts::resizable_byte_buffer T>
    void update(T& buffer, size_t offset = 0) {
      // ...
    }
  }

  class CBC_Mode : public Cipher_Mode {}
  class CBC_Encryption : public CBC_Mode {
  private:
  	void finish_msg(secure_vector<uint8_t>& final_block, size_t offset = 0) override;
  }

  void CBC_Encryption::finish_msg(secure_vector<uint8_t>& buffer, size_t offset) {
    // ...

    update(buffer, offset);
  }
(there's some other callers but they all use the same update overload).

So the full declaration will be something like
  template<concepts::resizable_byte_buffer = std::vector<unsigned char, Botan::secure_allocator<unsigned char>>>  // except as an instantiation, not a default
  void Botan::Cipher_Mode::update(std::vector<unsigned char, Botan::secure_allocator<unsigned char>>, unsigned long);
so llvm-cxxfilt gets it mostly right.

I don't really see why the concept bit is in there either,
it feels like it ought to be immaterial?

This must mean that's "The koncept" as an extension, then, clearly?
Maybe this wants to get forwarded to LLVM more-so than anything else.

Building with bookworm GCC doesn't give give me any symbols
matching /update/ except for an update_granularity.

#1108037#37
Date:
2025-07-10 20:21:27 UTC
From:
To:
[...]
[...]

You forwarded this to
<https://github.com/llvm/llvm-project/issues/147790> and the response
was that this extension was propsoed in
<https://github.com/itanium-cxx-abi/cxx-abi/issues/24> (opened in
2017!).

- The "Tk" sequence seems to be first mentioned by zygoloid on Mar 31,
2023

- g++ started generating this in 
<https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=c3f281a0c1ca50e4df5049923aa2f5d1c3c39ff6>
(September 2023)

- libiberty imported that change in 
<https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=e2a26339456487e80344a8c3bd0f10711ff28567>
(January 2024)

So it seems like the GNU tools also use this sequence, but perhaps they
have diverged from LLVM on the precise syntax...

Ben.

#1108037#42
Date:
2025-09-18 03:29:36 UTC
From:
To:
*你好吗?*

就让我们携手踏入探索长寿奥秘的旅程,洞悉那些令人惊叹的长寿法则。一旦领悟其精髓,或许能让你的一生远离病痛,轻松步入健康长寿的康庄大道。

以下是文章的主要内容:

一、均衡膳食:构筑长寿的坚实基石
二、适量运动:铸就长寿的坚实屏障
三、心理健康:解锁长寿的心灵密码
四、优质环境:助力长寿的绿色港湾
五、顺应节律:遵循自然的长寿智慧
这些信息十分珍贵,请务必查看完整内容!

*https://simpleurl.link/5-jing-ren-de-zhang-shou-ding-lu*
<https://simpleurl.link/5-jing-ren-de-zhang-shou-ding-lu>

祝好!
--- 追寻真相,是对良知最好的尊重