From: David Lamparter Date: Thu, 2 May 2024 09:00:17 +0000 (+0200) Subject: build: hppa is weird X-Git-Tag: base_10.1~102^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=2e84c37460e2f0f3444afe6645620c556a5f209a;p=matthieu%2Ffrr.git build: hppa is weird 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 --- diff --git a/python/clippy/elf.py b/python/clippy/elf.py index cc442eeda9..fd348428f0 100644 --- a/python/clippy/elf.py +++ b/python/clippy/elf.py @@ -458,7 +458,16 @@ class ELFSubset(object): - `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): """