[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

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



Control: tag -1 - moreinfo

On Wed, Jul 09, 2025 at 06:15:10PM +0200, Ben Hutchings wrote:
> What does the actual declaration of this function look like, and what
> toolchain are you using to compile it?

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).

> On Thu, 19 Jun 2025 16:09:24 +0200 =?utf-8?B?0L3QsNCx?= <nabijaczleweli@nabijaczleweli.xyz> wrote:
> >   +   89.76%     0.00%  bench    bench                 [.] _ZN5Botan11Cipher_Mode6updateITkNS_8concepts21resizable_byte_bufferESt6vectorIhNS_16secure_allocatorIhEEEEEvRT_m
> 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".

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?

> 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)".

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.

Attachment: signature.asc
Description: PGP signature


Reply to: