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=ecbd9f1b1f248fb5be182b3a78bc613591dba865

commit ecbd9f1b1f248fb5be182b3a78bc613591dba865
Author: Guillem Jover <guil...@debian.org>
AuthorDate: Tue Nov 23 02:26:50 2021 +0100

    Dpkg::Shlibs::Objdump: Fix apply_relocations to work with versioned symbols
    
    Since binutils 2.26 (commit bb4d2ac2cc637c61232624d9d359b8d3f031e3e9)
    versioned symbols in copy relocations are output as «symbol@@version»
    when they are in an undefined section (otherwise they use «@»). We were
    not taking this into account which meant these did not match and did not
    get marked as undefined, and got ignored for symbol dependency
    calculation.
    
    Try both the version qualified symbol and the bare symbol name to cope
    with old and new formats.
    
    Known to be affected are at least any-amd64, hppa and m68k architectures.
    
    Closes: #1000421
---
 scripts/Dpkg/Shlibs/Objdump.pm | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/scripts/Dpkg/Shlibs/Objdump.pm b/scripts/Dpkg/Shlibs/Objdump.pm
index 93319d1eb..c7b95365c 100644
--- a/scripts/Dpkg/Shlibs/Objdump.pm
+++ b/scripts/Dpkg/Shlibs/Objdump.pm
@@ -488,9 +488,24 @@ sub apply_relocations {
        # We want to mark as undefined symbols those which are currently
        # defined but that depend on a copy relocation
        next if not $sym->{defined};
-       next if not exists $self->{dynrelocs}{$sym->{name}};
-       if ($self->{dynrelocs}{$sym->{name}} =~ /^R_.*_COPY$/) {
+
+        my @relocs;
+
+        # When objdump qualifies the symbol with a version it will use @ when
+        # the symbol is in an undefined section (which we discarded above, or
+        # @@ otherwise.
+        push @relocs, $sym->{name} . '@@' . $sym->{version} if $sym->{version};
+
+        # Symbols that are not versioned, or versioned but shown with objdump
+        # fopm binutils < 2.26, do not have a version appended.
+        push @relocs, $sym->{name};
+
+        foreach my $reloc (@relocs) {
+            next if not exists $self->{dynrelocs}{$reloc};
+            next if not $self->{dynrelocs}{$reloc} =~ /^R_.*_COPY$/;
+
            $sym->{defined} = 0;
+            last;
        }
     }
 }

-- 
Dpkg.Org's dpkg

Reply via email to