[PATCH] Use elf_getphdrnum instead of accessing ehdr->e_phnum directly.