summaryrefslogtreecommitdiff
path: root/tools/kamek.py
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2012-07-01 01:54:39 +0200
committerTreeki <treeki@gmail.com>2012-07-01 01:54:39 +0200
commit99fd8f1a951ae33a6bc23b69035f14704862015b (patch)
tree04a0247385c0951cb61484b502e5b083f36f5f01 /tools/kamek.py
parentcaf65b91a27b583dc439c4e71561b818878d83d3 (diff)
downloadkamek-99fd8f1a951ae33a6bc23b69035f14704862015b.tar.gz
kamek-99fd8f1a951ae33a6bc23b69035f14704862015b.zip
Kamek now reports relocations to null
Diffstat (limited to 'tools/kamek.py')
-rw-r--r--tools/kamek.py11
1 files 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))