hppa (yes, HP PA-RISC) apparently creates relocations that refer to
".init+0x12345" for everything, referencing way past the end of the
.init section. While this is only fallback code hit when XREF_SETUP()
is missing (i.e. the FRRouting.XREF ELF note is absent), try to make it
work anyway.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
- `this[123:str]` - extract until null byte. The slice stop value is
the `str` type (or, technically, `unicode`.)
"""
- return self._obj[k]
+ if k.start < getattr(self._obj, "len", float("+Inf")):
+ return self._obj[k]
+
+ real_sect = self._elffile.get_section_addr(self._obj.sh_addr + k.start)
+ offs = self._obj.sh_addr - real_sect.sh_addr
+ if k.stop is str:
+ new_k = slice(k.start + offs, str)
+ else:
+ new_k = slice(k.start + offs, k.stop + offs)
+ return real_sect[new_k]
def getreloc(self, offset):
"""