ELF parsing utility function