summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Noga <Tempus@chronometry.ca>2012-06-30 18:55:41 -0500
committerColin Noga <Tempus@chronometry.ca>2012-06-30 18:55:41 -0500
commitf50c109f5e389d9389eb811820a359cce9180e9a (patch)
tree69923ed6579b338b8b09b575d811e5d2d46995a1
parent7c68d1c005f29531fc2dfeb64dd20ebd70315e3e (diff)
parent99fd8f1a951ae33a6bc23b69035f14704862015b (diff)
downloadkamek-f50c109f5e389d9389eb811820a359cce9180e9a.tar.gz
kamek-f50c109f5e389d9389eb811820a359cce9180e9a.zip
Merge branch 'level-select' of ssh://treeki.rustedlogic.net:30000/Kamek into level-select
-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))