This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch master in repository dpkg.
commit ca30a8d1dbbf5f978242b90d4f690116ae7004a9 Author: Guillem Jover <guil...@debian.org> Date: Sun Jan 29 01:07:38 2017 +0100 Dpkg::Shlibs::Objdump: Map alternative or old ELF machines to canonical ones Some ELF binaries contain alternative or old ELF machine types, which should match with their canonical forms. Map those before encoding the ABI. We ignore some mappings for things that should certainly never appear in current systems. Of note are EM_PPC_OLD (17) that conflicts with EM_VPP550 (17), and EM_PJ_OLD (99) that conflicts with EM_SNP1K (99). Warned-by: rebootstrap --- debian/changelog | 6 ++++++ scripts/Dpkg/Shlibs/Objdump.pm | 49 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/debian/changelog b/debian/changelog index 08764e1..81752e3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,11 @@ dpkg (1.18.21) UNRELEASED; urgency=medium + [ Guillem Jover ] + * Perl modules: + - Map alternative or old ELF machine types to canonical ones. We need + those to match on the encoded ABI, otherwise dpkg-shlibdeps will not + be able to find the objects. + [ Updated man pages translations ] * German (Helge Kreutzmann). diff --git a/scripts/Dpkg/Shlibs/Objdump.pm b/scripts/Dpkg/Shlibs/Objdump.pm index 197769d..3bf60f7 100644 --- a/scripts/Dpkg/Shlibs/Objdump.pm +++ b/scripts/Dpkg/Shlibs/Objdump.pm @@ -92,11 +92,33 @@ use constant { ELF_ORDER_2LSB => 1, ELF_ORDER_2MSB => 2, + ELF_MACH_SPARC => 2, ELF_MACH_MIPS => 8, + ELF_MACH_SPARC64_OLD => 11, + ELF_MACH_SPARC32PLUS => 18, ELF_MACH_PPC64 => 21, + ELF_MACH_S390 => 22, ELF_MACH_ARM => 40, + ELF_MACH_ALPHA_OLD => 41, ELF_MACH_SH => 42, + ELF_MACH_SPARC64 => 43, ELF_MACH_IA64 => 50, + ELF_MACH_AVR => 83, + ELF_MACH_M32R => 88, + ELF_MACH_MN10300 => 89, + ELF_MACH_MN10200 => 90, + ELF_MACH_OR1K => 92, + ELF_MACH_XTENSA => 94, + ELF_MACH_MICROBLAZE => 189, + ELF_MACH_AVR_OLD => 0x1057, + ELF_MACH_OR1K_OLD => 0x8472, + ELF_MACH_ALPHA => 0x9026, + ELF_MACH_M32R_CYGNUS => 0x9041, + ELF_MACH_S390_OLD => 0xa390, + ELF_MACH_XTENSA_OLD => 0xabc7, + ELF_MACH_MICROBLAZE_OLD => 0xbaab, + ELF_MACH_MN10300_CYGNUS => 0xbeef, + ELF_MACH_MN10200_CYGNUS => 0xdead, ELF_VERSION_NONE => 0, ELF_VERSION_CURRENT => 1, @@ -124,6 +146,20 @@ use constant { ELF_FLAG_SH_MACH_MASK => 0x0000001f, }; +# These map alternative or old machine IDs to their canonical form. +my %elf_mach_map = ( + ELF_MACH_ALPHA_OLD() => ELF_MACH_ALPHA, + ELF_MACH_AVR_OLD() => ELF_MACH_AVR, + ELF_MACH_M32R_CYGNUS() => ELF_MACH_M32R, + ELF_MACH_MICROBLAZE_OLD() => ELF_MACH_MICROBLAZE, + ELF_MACH_MN10200_CYGNUS() => ELF_MACH_MN10200, + ELF_MACH_MN10300_CYGNUS() => ELF_MACH_MN10300, + ELF_MACH_OR1K_OLD() => ELF_MACH_OR1K, + ELF_MACH_S390_OLD() => ELF_MACH_S390, + ELF_MACH_SPARC64_OLD() => ELF_MACH_SPARC64, + ELF_MACH_XTENSA_OLD() => ELF_MACH_XTENSA, +); + # These masks will try to expose processor flags that are ABI incompatible, # and as such are part of defining the architecture ABI. If uncertain it is # always better to not mask a flag, because that preserves the historical @@ -177,6 +213,19 @@ sub get_format { my $tmpl = "x16(S2Lx[${elf_word}3]L)${elf_endian}"; @elf{qw(type mach version flags)} = unpack $tmpl, $header; + # XXX: We need to special case ELF_MACH_SPARC32PLUS, because NetBSD + # treats it differently depending on the ELF bits. + if ($elf{mach} == ELF_MACH_SPARC32PLUS) { + if ($elf{bits} == ELF_BITS_32) { + $elf{mach} = ELF_MACH_SPARC; + } else { + $elf{mach} = ELF_MACH_SPARC64; + } + } + + # Canonicalize the machine ID. + $elf{mach} = $elf_mach_map{$elf{mach}} // $elf{mach}; + # Mask any processor flags that might not change the architecture ABI. $elf{flags} &= $elf_flags_mask{$elf{mach}} // 0; -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/dpkg/dpkg.git