aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Gautier <matthieu.gautier@mgautier.fr>2016-12-21 19:43:20 +0100
committerJussi Pakkanen <jpakkane@gmail.com>2016-12-21 22:03:18 +0200
commit9d1e426bcc2980276f97453c570bc59d9c009c78 (patch)
tree9658e4ada8df961284476d348dcceab9ea9fe893
parentde0b02ee2d3847de9787e6b0ac32ebcb61018e15 (diff)
downloadmeson-9d1e426bcc2980276f97453c570bc59d9c009c78.zip
meson-9d1e426bcc2980276f97453c570bc59d9c009c78.tar.gz
meson-9d1e426bcc2980276f97453c570bc59d9c009c78.tar.bz2
Fix installation of statically linked executable for ELF binary.
At installation, if the executable is a ELF file, we try to fix the dependencies in the binary section. If a executable has been compiled with the --static flag, there is no .dynamic section in the ELF binary and so we need to handle this case.
-rw-r--r--authors.txt1
-rw-r--r--mesonbuild/scripts/depfixer.py7
2 files changed, 8 insertions, 0 deletions
diff --git a/authors.txt b/authors.txt
index 12e944e..9811dca 100644
--- a/authors.txt
+++ b/authors.txt
@@ -58,3 +58,4 @@ Paulo Antonio Alvarez
Olexa Bilaniuk
Daniel Stone
Marc-Antoine Perennou
+Matthieu Gautier
diff --git a/mesonbuild/scripts/depfixer.py b/mesonbuild/scripts/depfixer.py
index ed77b56..baa401e 100644
--- a/mesonbuild/scripts/depfixer.py
+++ b/mesonbuild/scripts/depfixer.py
@@ -196,6 +196,8 @@ class Elf(DataSizes):
def parse_dynamic(self):
sec = self.find_section(b'.dynamic')
self.dynamic = []
+ if sec is None:
+ return
self.bf.seek(sec.sh_offset)
while True:
e = DynamicEntry(self.bf, self.ptrsize, self.is_le)
@@ -218,6 +220,9 @@ class Elf(DataSizes):
soname = i
if i.d_tag == DT_STRTAB:
strtab = i
+ else:
+ print("This file does not have a soname")
+ return
self.bf.seek(strtab.val + soname.val)
print(self.read_str())
@@ -300,6 +305,8 @@ class Elf(DataSizes):
def remove_rpath_entry(self, entrynum):
sec = self.find_section(b'.dynamic')
+ if sec is None:
+ return None
for (i, entry) in enumerate(self.dynamic):
if entry.d_tag == entrynum:
rpentry = self.dynamic[i]