Browse Source

Dpkg::Shlibs::Objdump: Encode the ELF ABI as a big-endian byte stream

This way when unpacking for output, the result gives meaningful results.
Guillem Jover 9 years ago
parent
commit
8efe8ef489
2 changed files with 5 additions and 2 deletions
  1. 2 0
      debian/changelog
  2. 3 2
      scripts/Dpkg/Shlibs/Objdump.pm

+ 2 - 0
debian/changelog

@@ -6,6 +6,8 @@ dpkg (1.18.20) UNRELEASED; urgency=medium
       Dpkg::Shlibs::Objdump. These do not define the ABI, and make the
       objects not match when they should, when looking for shared libraries
       from dpkg-shlibdeps.
+    - Encode the ELF ABI as a big-endian byte stream, so that decoding for
+      output gives meaningful results.
 
   [ Updated scripts translations ]
   * German (Helge Kreutzmann).

+ 3 - 2
scripts/Dpkg/Shlibs/Objdump.pm

@@ -180,8 +180,9 @@ sub get_format {
     # Mask any processor flags that might not change the architecture ABI.
     $elf{flags} &= $elf_flags_mask{$elf{mach}} // 0;
 
-    # Repack for easy comparison.
-    $format{$file} = pack 'C2SL', @elf{qw(bits endian mach flags)};
+    # Repack for easy comparison, as a big-endian byte stream, so that
+    # unpacking for output gives meaningful results.
+    $format{$file} = pack 'C2(SL)>', @elf{qw(bits endian mach flags)};
 
     return $format{$file};
 }