diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2024-05-02 11:00:17 +0200 | 
|---|---|---|
| committer | David Lamparter <equinox@opensourcerouting.org> | 2024-05-02 23:03:08 +0200 | 
| commit | 2e84c37460e2f0f3444afe6645620c556a5f209a (patch) | |
| tree | e11c2cac877b4bd30764adb765e97c7efefef937 /python | |
| parent | 85b09765c45e3fcfc1eb1400eff659454850a42f (diff) | |
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 <equinox@opensourcerouting.org>
Diffstat (limited to 'python')
| -rw-r--r-- | python/clippy/elf.py | 11 | 
1 files changed, 10 insertions, 1 deletions
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):          """  | 
