summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2009-06-16 15:34:12 (GMT)
committerEelco Dolstra <e.dolstra@tudelft.nl>2009-06-16 15:34:12 (GMT)
commitfc79f8a85aeea990a89defd74b9ce52f59b29ebe (patch)
treebe48529aea1a97e12629533099daf9690489039a /src
parentecb2b0c96fe83d02d42c75c7ed832721ffd97067 (diff)
downloadpatchelf-fc79f8a85aeea990a89defd74b9ce52f59b29ebe.zip
patchelf-fc79f8a85aeea990a89defd74b9ce52f59b29ebe.tar.gz
patchelf-fc79f8a85aeea990a89defd74b9ce52f59b29ebe.tar.bz2
* Use the e_type field instead of trying to guess whether we’re
dealing with an executable or dynamic library. Fixes NIXPKGS-98.
Diffstat (limited to 'src')
-rw-r--r--src/patchelf.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/patchelf.cc b/src/patchelf.cc
index 58404d9..0e04151 100644
--- a/src/patchelf.cc
+++ b/src/patchelf.cc
@@ -579,7 +579,7 @@ void ElfFile<ElfFileParamNames>::rewriteSectionsLibrary()
/* Add a segment that maps the replaced sections and program
- headers into memory.. */
+ headers into memory. */
phdrs.resize(rdi(hdr->e_phnum) + 1);
wri(hdr->e_phnum, rdi(hdr->e_phnum) + 1);
Elf_Phdr & phdr = phdrs[rdi(hdr->e_phnum) - 1];
@@ -725,13 +725,13 @@ void ElfFile<ElfFileParamNames>::rewriteSections()
debug("replacing section `%s' with size %d\n",
i->first.c_str(), i->second.size());
- if (!findSection2(".interp")) {
- debug("no .interp section; this is a dynamic library\n");
+ if (rdi(hdr->e_type) == ET_DYN) {
+ debug("this is a dynamic library\n");
rewriteSectionsLibrary();
- } else {
- debug("found .interp section; this is an executable\n");
+ } else if (rdi(hdr->e_type) == ET_EXEC) {
+ debug("this is an executable\n");
rewriteSectionsExecutable();
- }
+ } else error("unknown ELF type");
}