]> git.puffer.fish Git - matthieu/frr.git/commitdiff
build: hppa is weird
authorDavid Lamparter <equinox@opensourcerouting.org>
Thu, 2 May 2024 09:00:17 +0000 (11:00 +0200)
committerDavid Lamparter <equinox@opensourcerouting.org>
Thu, 2 May 2024 21:03:08 +0000 (23:03 +0200)
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>
python/clippy/elf.py

index cc442eeda9aa0a64b1c00195cc96319e1e48d8a5..fd348428f0ad7fe257831bbcd296716709b186be 100644 (file)
@@ -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):
         """