During the Windows test suite work, a fun little problem for ELFish targets was found. It seems that the in memory reflection doesn't really work in practice (outside of the tests). The particular issue that I am currently thinking about involves the location of the section containing the relevant metadata. Section names are stored in the
shstrtab section with the
shdr->sh_info containing an offset into the section. This is problematic since
shstrtab is normally not mapped into the VA of the image. This means that we cannot find a section by name (there is no real equivalent to
getsectbyname from dyld).
My current thought is that we should employ the use of section flags here, as ELF has
0xffffffff reserved as user defined value ranges for the application (
shdr->sh_flags & SHT_PROGBITS indicates that the data is program data, and then
shdr->sh_flags & ~SHT_LOUSER should give us the program specific bits that we can play with to enumerate the section types).
Am I forgetting something about ELF loading/handling? Is this a reasonable approach? This should improve the reflection support on ELFish targets.