diff --git a/src/elfwrite.cpp b/src/elfwrite.cpp index a22fd616ad2f36819162552ab674d527e0fff91e..89e68b249e150685ea0d4162272ed7701367f5f7 100644 --- a/src/elfwrite.cpp +++ b/src/elfwrite.cpp @@ -406,7 +406,7 @@ bool ElfWriterImpl<T_Elf_Ehdr,T_Elf_Phdr,T_Elf_Addr,T_Elf_Shdr,T_Elf_Sym, T_Elf_ } // find segment - int new_phdr_segment_index=locate_segment_index(new_phdr_addr); + int new_phdr_segment_index=locate_segment_index(new_phdr_addr-1); // if there's no segment for the start, we'll have to allocate a page anyhow. just use the _Preallocate routine. if(new_phdr_segment_index==-1)