diff options
| author | Donald Sharp <donaldsharp72@gmail.com> | 2024-05-06 10:29:05 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-06 10:29:05 -0400 |
| commit | 216bac2826d60c47615cf50df1833c5c8543c75e (patch) | |
| tree | b84c9e08d3113e1dd478d7fc222a0c77b07dbcca /python/clippy/elf.py | |
| parent | 9de2f138f0b3e76324dfb9a11d85fbf6c13b8b89 (diff) | |
| parent | 2e84c37460e2f0f3444afe6645620c556a5f209a (diff) | |
Merge pull request #15902 from opensourcerouting/build-xref-setup-hppa
build: fix missing `XREF_SETUP` (and HP PA-RISC build failure)
Diffstat (limited to 'python/clippy/elf.py')
| -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): """ |
