User mode support for Linux ELF files with no section header

In user mode Linux, Qemu currently refuses to load ELF files that do not
contain section headers (ehdr->e_shentsize == 0). Since section headers are not
required in order to load an ELF file, simply removing the e_shentsize check in
elf_check_ehdr() allows ELF binaries with no section headers to be run properly
in user mode:

Signed-off-by: Craig Heffner <cheffner@tacnetsol.com>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
This commit is contained in:
Craig Heffner 2011-12-05 14:14:27 -05:00 committed by Riku Voipio
parent 480eda2eda
commit d3606f0744

View File

@ -1292,7 +1292,6 @@ static bool elf_check_ehdr(struct elfhdr *ehdr)
return (elf_check_arch(ehdr->e_machine) return (elf_check_arch(ehdr->e_machine)
&& ehdr->e_ehsize == sizeof(struct elfhdr) && ehdr->e_ehsize == sizeof(struct elfhdr)
&& ehdr->e_phentsize == sizeof(struct elf_phdr) && ehdr->e_phentsize == sizeof(struct elf_phdr)
&& ehdr->e_shentsize == sizeof(struct elf_shdr)
&& (ehdr->e_type == ET_EXEC || ehdr->e_type == ET_DYN)); && (ehdr->e_type == ET_EXEC || ehdr->e_type == ET_DYN));
} }