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=47516cd128aa2ff5d2dcc222dd7c7f8582b69d3f

commit 47516cd128aa2ff5d2dcc222dd7c7f8582b69d3f
Author: Guillem Jover <[email protected]>
AuthorDate: Mon Dec 8 01:23:23 2025 +0100

    Dpkg::Shlibs::Objdump::Object: Add support for "Version References" symbols
    
    New binutils can emit dependencies on specific versions via the
    DT_VERNEED tags in the .gnu.version_r section. But these dependencies
    are not exposed in the Dynamic Symbol Table.
    
    Inject those dependencies as if they were normal undefined symbols into
    the object metadata.
    
    Closes: #1122107
    Stable-Candidate: 1.22.x
---
 scripts/Dpkg/Shlibs/Objdump/Object.pm | 36 +++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/scripts/Dpkg/Shlibs/Objdump/Object.pm 
b/scripts/Dpkg/Shlibs/Objdump/Object.pm
index cc635a24e..63e944ffd 100644
--- a/scripts/Dpkg/Shlibs/Objdump/Object.pm
+++ b/scripts/Dpkg/Shlibs/Objdump/Object.pm
@@ -109,6 +109,7 @@ sub parse_objdump_output {
     my ($self, $fh) = @_;
 
     my $section = 'none';
+    my $verneed_lib = undef;
     while (<$fh>) {
         s/\s*$//;
         next if length == 0;
@@ -164,6 +165,12 @@ sub parse_objdump_output {
                     $self->{RPATH} = [ split /:/, $rpath ];
                 }
             }
+        } elsif ($section eq 'verref') {
+            if (/^\s*required from ([^:]*):/) {
+                $verneed_lib = $1;
+            } elsif (/^\s*0x[[:xdigit:]]*\s*0x[[:xdigit:]]*\s*\d*\s*(.*)/) {
+                $self->add_verneed_symbol($verneed_lib, $1);
+            }
         } elsif ($section eq 'program') {
             if (/^\s*INTERP\s+/) {
                 $self->{INTERP} = 1;
@@ -307,6 +314,35 @@ sub apply_relocations {
     }
 }
 
+# Inject the version reference dependency as an undefined symbol into the
+# dynamic symbol information.
+#
+# We do not currently use the $solib name, which would denote a stronger
+# tighter dependency on a specific shared object, but for now this should
+# suffice.
+sub add_verneed_symbol($self, $solib, $name)
+{
+    my $symbol = {
+        name => $name,
+        version => $name,
+        section => '*UND*',
+        dynamic => 1,
+        debug => 0,
+        type => 'O',
+        weak => 0,
+        local => 0,
+        global => 1,
+        visibility => '',
+        hidden => '',
+        defined => 0,
+    };
+
+    # Register artificial symbol.
+    $self->add_dynamic_symbol($symbol);
+
+    return;
+}
+
 sub add_dynamic_symbol {
     my ($self, $symbol) = @_;
     $symbol->{objid} = $symbol->{soname} = $self->get_id();

-- 
Dpkg.Org's dpkg

Reply via email to