@@ -104,8 +104,6 @@ class ElfFile
104
104
105
105
bool changed = false ;
106
106
107
- bool isExecutable = false ;
108
-
109
107
typedef std::string SectionName;
110
108
typedef std::map<SectionName, std::string> ReplacedSections;
111
109
@@ -414,10 +412,8 @@ ElfFile<ElfFileParamNames>::ElfFile(FileContents fileContents)
414
412
error (" program headers have wrong size" );
415
413
416
414
/* Copy the program and section headers. */
417
- for (int i = 0 ; i < rdi (hdr->e_phnum ); ++i) {
415
+ for (int i = 0 ; i < rdi (hdr->e_phnum ); ++i)
418
416
phdrs.push_back (* ((Elf_Phdr *) (contents + rdi (hdr->e_phoff )) + i));
419
- if (rdi (phdrs[i].p_type ) == PT_INTERP) isExecutable = true ;
420
- }
421
417
422
418
for (int i = 0 ; i < rdi (hdr->e_shnum ); ++i)
423
419
shdrs.push_back (* ((Elf_Shdr *) (contents + rdi (hdr->e_shoff )) + i));
@@ -742,12 +738,10 @@ void ElfFile<ElfFileParamNames>::rewriteSectionsLibrary()
742
738
since DYN executables tend to start at virtual address 0, so
743
739
rewriteSectionsExecutable() won't work because it doesn't have
744
740
any virtual address space to grow downwards into. */
745
- if (isExecutable) {
746
- if (startOffset >= startPage) {
747
- debug (" shifting new PT_LOAD segment by %d bytes to work around a Linux kernel bug\n " , startOffset - startPage);
748
- }
749
- startPage = startOffset;
741
+ if (startOffset >= startPage) {
742
+ debug (" shifting new PT_LOAD segment by %d bytes to work around a Linux kernel bug\n " , startOffset - startPage);
750
743
}
744
+ startPage = startOffset;
751
745
752
746
/* Add a segment that maps the replaced sections into memory. */
753
747
phdrs.resize (rdi (hdr->e_phnum ) + 1 );
0 commit comments