diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2013-10-04 23:43:42 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2013-10-04 23:43:42 +0300 |
commit | 62a607c0571ea3e1ef58a5ab4cd834f05fa0fa51 (patch) | |
tree | d0cae8b53de250f5d122db19ce1e51cafcc47cdd /depfixer.py | |
parent | 9f05fce831c5987346421687cc584df7c3907db6 (diff) | |
download | meson-62a607c0571ea3e1ef58a5ab4cd834f05fa0fa51.zip meson-62a607c0571ea3e1ef58a5ab4cd834f05fa0fa51.tar.gz meson-62a607c0571ea3e1ef58a5ab4cd834f05fa0fa51.tar.bz2 |
Some more tests passing.
Diffstat (limited to 'depfixer.py')
-rwxr-xr-x | depfixer.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/depfixer.py b/depfixer.py index c93d58c..5585501 100755 --- a/depfixer.py +++ b/depfixer.py @@ -191,12 +191,16 @@ class Elf(): sec = self.find_section(b'.dynstr') for i in self.dynamic: if i.d_tag == DT_RPATH: - rpath = i - return sec.sh_offset + rpath.val + return sec.sh_offset + i.val + return None def print_rpath(self): - self.bf.seek(self.get_rpath_offset()) - print(self.read_str()) + offset = self.get_rpath_offset() + if offset is None: + print("This file does not have an rpath.") + else: + self.bf.seek(offset) + print(self.read_str()) def print_deps(self): sec = self.find_section(b'.dynstr') @@ -230,6 +234,9 @@ class Elf(): def fix_rpath(self, new_rpath): rp_off = self.get_rpath_offset() + if rp_off is None: + print('File does not have rpath. It should be a fully static executable.') + return self.bf.seek(rp_off) old_rpath = self.read_str() if len(old_rpath) < len(new_rpath): |