From 99fd8f1a951ae33a6bc23b69035f14704862015b Mon Sep 17 00:00:00 2001 From: Treeki Date: Sun, 1 Jul 2012 01:54:39 +0200 Subject: Kamek now reports relocations to null --- tools/kamek.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tools/kamek.py b/tools/kamek.py index 43b4556..534eac8 100644 --- a/tools/kamek.py +++ b/tools/kamek.py @@ -189,16 +189,17 @@ class DyLinkCreator(object): sym_id = entry['r_info_sym'] try: - sym_value = sym_values[sym_id] + sym_value, sym_name = sym_values[sym_id] except KeyError: sym = sym_section.get_symbol(sym_id) sym_value = sym.entry['st_value'] - sym_values[sym_id] = sym_value + sym_name = sym.name + sym_values[sym_id] = (sym_value, sym_name) #print hex(sym_value) - self.add_reloc(entry['r_info_type'], entry['r_offset'], sym_value+entry['r_addend']) + self.add_reloc(entry['r_info_type'], entry['r_offset'], sym_value+entry['r_addend'], sym_name) - def add_reloc(self, reltype, addr, target): + def add_reloc(self, reltype, addr, target, name="UNKNOWN NAME"): if reltype not in self.VALID_RELOCS: raise ValueError('Unknown/unsupported rel type: %d (%x => %x)' % (reltype, addr, target)) @@ -208,6 +209,8 @@ class DyLinkCreator(object): target_id = len(self._targets) self._target_lookups[target] = target_id self._targets.append(target) + if target <= 0: + print("Warning: The following reloc (%x) points to %d: Is this right? %s" % (addr, target, name)) self._relocs.append((reltype, addr, target_id)) -- cgit v1.2.3