From fc79f8a85aeea990a89defd74b9ce52f59b29ebe Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 16 Jun 2009 15:34:12 +0000 Subject: =?UTF-8?q?*=20Use=20the=20e=5Ftype=20field=20instead=20of=20tryin?= =?UTF-8?q?g=20to=20guess=20whether=20we=E2=80=99re=20=20=20dealing=20with?= =?UTF-8?q?=20an=20executable=20or=20dynamic=20library.=20=20Fixes=20NIXPK?= =?UTF-8?q?GS-98.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/patchelf.cc | 12 ++++++------ 1 file 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::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::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"); } -- cgit v0.12