summaryrefslogtreecommitdiff
path: root/python/clippy/elf.py
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2021-04-08 00:00:27 +0200
committerDavid Lamparter <equinox@diac24.net>2021-04-08 00:01:07 +0200
commitb17f302b2015c0e8d97a0ff3f023b83830a6ec6f (patch)
tree810c8ee3720e58eb7087d16335aa85c0dc254519 /python/clippy/elf.py
parent81693617a258a5e56ffc57ff6c37755e98beda18 (diff)
python: fix 32-bit pointers in xrelfo container_of
This was mistakenly using the host platform's pointer size rather than the ELF file's. Only noticeable when cross compiling... Signed-off-by: David Lamparter <equinox@diac24.net>
Diffstat (limited to 'python/clippy/elf.py')
-rw-r--r--python/clippy/elf.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/python/clippy/elf.py b/python/clippy/elf.py
index 4ed334f0c4..02cb2e38b3 100644
--- a/python/clippy/elf.py
+++ b/python/clippy/elf.py
@@ -162,7 +162,10 @@ class ELFDissectData(object):
for field in parent._efields[self.elfclass]:
if field[0] == fieldname:
break
- offset += struct.calcsize(field[1])
+ spec = field[1]
+ if spec == 'P':
+ spec = 'I' if self.elfclass == 32 else 'Q'
+ offset += struct.calcsize(spec)
else:
raise AttributeError('%r not found in %r.fields' % (fieldname, parent))