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>
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))