X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=kernel%2Fkexec_file.c;h=6d787ae9deca0fceda9cd7048313a55abb4c3eea;hb=refs%2Fheads%2Ftizen-6.1.y;hp=45637511e0de69ee5ef68c7936875efb813a6d06;hpb=4da34b7d175dc99b8befebd69e96546c960d526c;p=platform%2Fkernel%2Flinux-starfive.git diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index 4563751..6d787ae9 100644 --- a/kernel/kexec_file.c +++ b/kernel/kexec_file.c @@ -898,10 +898,22 @@ static int kexec_purgatory_setup_sechdrs(struct purgatory_info *pi, } offset = ALIGN(offset, align); + + /* + * Check if the segment contains the entry point, if so, + * calculate the value of image->start based on it. + * If the compiler has produced more than one .text section + * (Eg: .text.hot), they are generally after the main .text + * section, and they shall not be used to calculate + * image->start. So do not re-calculate image->start if it + * is not set to the initial value, and warn the user so they + * have a chance to fix their purgatory's linker script. + */ if (sechdrs[i].sh_flags & SHF_EXECINSTR && pi->ehdr->e_entry >= sechdrs[i].sh_addr && pi->ehdr->e_entry < (sechdrs[i].sh_addr - + sechdrs[i].sh_size)) { + + sechdrs[i].sh_size) && + !WARN_ON(kbuf->image->start != pi->ehdr->e_entry)) { kbuf->image->start -= sechdrs[i].sh_addr; kbuf->image->start += kbuf->mem + offset; }