This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch main
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=7e27cbae0ed0aef3e2da3f28256b671c6a9aecd2

commit 7e27cbae0ed0aef3e2da3f28256b671c6a9aecd2
Author: Guillem Jover <[email protected]>
AuthorDate: Fri Jul 5 01:16:18 2024 +0200

    Dpkg::Shlibs::Cppfilt: Normalize demangled symbols with llvm or C++11 format
    
    The output from c++filt from llvm produces no spaces between ending
    angle brackets (<<symbol>>) as allowed by C++11, contrary to what
    GNU binutils does by default as it was not allowed before C++11.
    
    Because this is used to compare against demangled symbols in symbols
    files, we need to use an unified format, given that the space around
    angle brackets is more compatible, and has been the default when using
    GNU binutils, we normalize into that.
---
 scripts/Dpkg/Shlibs/Cppfilt.pm | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/scripts/Dpkg/Shlibs/Cppfilt.pm b/scripts/Dpkg/Shlibs/Cppfilt.pm
index 1f054a111..010fe6634 100644
--- a/scripts/Dpkg/Shlibs/Cppfilt.pm
+++ b/scripts/Dpkg/Shlibs/Cppfilt.pm
@@ -96,8 +96,14 @@ sub cppfilt_demangle {
        my $demangled = readline($filt->{to});
        chop $demangled;
 
-       # If the symbol was not demangled, return undef
-       $demangled = undef if $symbol eq $demangled;
+        # If the symbol was not demangled, return undef. Otherwise normalize
+        # it as llvm packs ending angle brackets with no intermediate spaces
+        # as allowed by C++11, contrary to GNU binutils.
+        if ($symbol eq $demangled) {
+            $demangled = undef;
+        } else {
+            $demangled =~ s{(?<=>)(?=>)}{ }g;
+        }
 
        # Remember the last result
        $filt->{last_symbol} = $symbol;

-- 
Dpkg.Org's dpkg

Reply via email to