summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README4
-rw-r--r--configure.ac2
-rw-r--r--release.nix3
-rw-r--r--src/patchelf.cc15
4 files changed, 19 insertions, 5 deletions
diff --git a/README b/README
index bc5c311..b4d19c9 100644
--- a/README
+++ b/README
@@ -47,6 +47,10 @@ libraries. In particular, it can do the following:
This option can be give multiple times.
+* Change SONAME of a dynamic library:
+
+ $ patchelf --set-soname libnewname.so.3.4.5 path/to/libmylibrary.so.1.2.3
+
INSTALLING
diff --git a/configure.ac b/configure.ac
index d08a006..c2e5e98 100644
--- a/configure.ac
+++ b/configure.ac
@@ -13,7 +13,7 @@ AC_ARG_WITH([page-size],
)
if test "$PAGESIZE" = auto; then
- if type -p getconf &>/dev/null; then
+ if command -v getconf >/dev/null; then
PAGESIZE=$(getconf PAGESIZE || getconf PAGE_SIZE)
fi
if test "$PAGESIZE" = auto -o -z "$PAGESIZE"; then
diff --git a/release.nix b/release.nix
index 8aa787b..16e6fe8 100644
--- a/release.nix
+++ b/release.nix
@@ -44,6 +44,8 @@ let
isReproducible = system != "aarch64-linux"; # ARM machines are still on Nix 1.11
});
+ rpm_centos73x86_64 = makeRPM_x86_64 (diskImages: diskImages.centos73x86_64);
+ rpm_centos74x86_64 = makeRPM_x86_64 (diskImages: diskImages.centos74x86_64);
rpm_fedora24i386 = makeRPM_i686 (diskImages: diskImages.fedora24i386);
rpm_fedora24x86_64 = makeRPM_x86_64 (diskImages: diskImages.fedora24x86_64);
@@ -72,6 +74,7 @@ let
#build.x86_64-freebsd
#build.i686-freebsd
#build.x86_64-darwin
+ rpm_centos74x86_64
rpm_fedora25i386
rpm_fedora25x86_64
deb_debian8i386
diff --git a/src/patchelf.cc b/src/patchelf.cc
index 855243a..cd46f7e 100644
--- a/src/patchelf.cc
+++ b/src/patchelf.cc
@@ -397,10 +397,13 @@ ElfFile<ElfFileParamNames>::ElfFile(FileContents fileContents)
error("wrong ELF type");
if ((size_t) (rdi(hdr->e_phoff) + rdi(hdr->e_phnum) * rdi(hdr->e_phentsize)) > fileContents->size())
- error("missing program headers");
+ error("program header table out of bounds");
+
+ if (rdi(hdr->e_shnum) == 0)
+ error("no section headers. The input file is probably a statically linked, self-decompressing binary");
if ((size_t) (rdi(hdr->e_shoff) + rdi(hdr->e_shnum) * rdi(hdr->e_shentsize)) > fileContents->size())
- error("missing section headers");
+ error("section header table out of bounds");
if (rdi(hdr->e_phentsize) != sizeof(Elf_Phdr))
error("program headers have wrong size");
@@ -562,8 +565,12 @@ template<ElfFileParams>
Elf_Shdr & ElfFile<ElfFileParamNames>::findSection(const SectionName & sectionName)
{
Elf_Shdr * shdr = findSection2(sectionName);
- if (!shdr)
- error("cannot find section '" + sectionName + "'");
+ if (!shdr) {
+ std::string extraMsg = "";
+ if (sectionName == ".interp" || sectionName == ".dynamic" || sectionName == ".dynstr")
+ extraMsg = ". The input file is most likely statically linked";
+ error("cannot find section '" + sectionName + "'" + extraMsg);
+ }
return *shdr;
}