summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTuomas Tynkkynen <tuomas@tuxera.com>2017-04-19 14:14:19 (GMT)
committerTuomas Tynkkynen <tuomas@tuxera.com>2017-04-19 14:33:33 (GMT)
commitbfc3db32d26cbf6d1aa96aa0fd9a82aa5576ba17 (patch)
tree69c92b1905041420589c26750e369b747a6e4c35
parente44c318b37050cad5f676505cc1cd9efaecf18c4 (diff)
downloadpatchelf-bfc3db32d26cbf6d1aa96aa0fd9a82aa5576ba17.zip
patchelf-bfc3db32d26cbf6d1aa96aa0fd9a82aa5576ba17.tar.gz
patchelf-bfc3db32d26cbf6d1aa96aa0fd9a82aa5576ba17.tar.bz2
Improve error message when run on statically linked binaries
If .dynamic, .dynstr or .interp sections aren't found, give an extra hint to the user that the input file is statically linked.
-rw-r--r--src/patchelf.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/patchelf.cc b/src/patchelf.cc
index bfd9cc1..6363395 100644
--- a/src/patchelf.cc
+++ b/src/patchelf.cc
@@ -557,8 +557,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;
}