#!/usr/bin/perl -w sub main { my ($disasm, $reloc) = @_; open DISASM, "<$disasm" or die "open $disasm"; open RELOC, "<$reloc" or die "open $reloc"; do {$_ = } until (/RELOCATION RECORDS FOR \[\.text\]:/); ; while () { last if /^$/; my ($address) = split ' '; $reloc{hex($address)} = $_; } while () { if (/^ *([0-9a-f]+):/) { my $dis_add = hex($1); if (defined($reloc{$dis_add})) { print ";$reloc{$dis_add}"; delete $reloc{$dis_add}; } } print; } foreach (sort keys %reloc) { print ";UNFOUND: $reloc{$_}"; } } main(@ARGV);