[diffoscope] 04/09: Filter symbols for IP-relative ops from ELF disassembled output

Jérémy Bobbio lunar at moszumanska.debian.org
Tue Jan 19 18:22:30 CET 2016

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

lunar pushed a commit to branch master
in repository diffoscope.

commit 998c09436c58b53e2e255e24b292fdd700faef89
Author: Jérémy Bobbio <lunar at debian.org>
Date:   Tue Jan 19 16:29:52 2016 +0100

    Filter symbols for IP-relative ops from ELF disassembled output
    `objdump --disassemble` displays symbols+offsets for addresses
    it derives from IP-relative addressing. If the offsets are different,
    that results in showing a difference even if the actual code is the same.
    As we care about actual differences, let's filter them from the output.
    Thanks Mike Hommey for the suggestion and the test case.
    Closes: #808207
 diffoscope/comparators/elf.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/diffoscope/comparators/elf.py b/diffoscope/comparators/elf.py
index 0721ff8..c3decea 100644
--- a/diffoscope/comparators/elf.py
+++ b/diffoscope/comparators/elf.py
@@ -165,6 +165,8 @@ class ObjdumpSection(Command):
         return line
 class ObjdumpDisassembleSection(ObjdumpSection):
+    RE_SYMBOL_COMMENT = re.compile(rb'^( [0-9a-f]+:[^#]+)# [0-9a-f]+ <[^>]+>$')
     def objdump_options(self):
         # With '--line-numbers' we get the source filename and line within the
         # disassembled instructions.
@@ -172,6 +174,11 @@ class ObjdumpDisassembleSection(ObjdumpSection):
         # stripped symbols file specified in the .gnu_debuglink section
         return ['--line-numbers', '--disassemble']
+    def filter(self, line):
+        line = super().filter(line)
+        return ObjdumpDisassembleSection.RE_SYMBOL_COMMENT.sub(r'\1', line)
 READELF_COMMANDS = [ReadelfFileHeader,

Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git

More information about the diffoscope mailing list