mirror of
https://github.com/NixOS/patchelf.git
synced 2025-10-23 00:58:24 +08:00
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.
This commit is contained in:
@@ -557,8 +557,12 @@ template<ElfFileParams>
|
|||||||
Elf_Shdr & ElfFile<ElfFileParamNames>::findSection(const SectionName & sectionName)
|
Elf_Shdr & ElfFile<ElfFileParamNames>::findSection(const SectionName & sectionName)
|
||||||
{
|
{
|
||||||
Elf_Shdr * shdr = findSection2(sectionName);
|
Elf_Shdr * shdr = findSection2(sectionName);
|
||||||
if (!shdr)
|
if (!shdr) {
|
||||||
error("cannot find section '" + sectionName + "'");
|
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;
|
return *shdr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user