Optimize test for valid ELF symbol types in lookup function.