Fix Thumb platform preservation for ELF mini debug symbols#8143
Fix Thumb platform preservation for ELF mini debug symbols#8143
Conversation
| std::map<uint64_t, uint64_t> m_localGotEntries; | ||
| std::set<uint64_t> m_gotEntryLocations; | ||
| std::vector<BNRelocationInfo> m_relocationInfo; | ||
| std::vector<Ref<Metadata>> m_miniDebugSymbolAddresses; |
There was a problem hiding this comment.
Recommend naming this m_miniDebugSymbolOriginalAddresses or something that indicates these addresses aren't the symbol addresses, but rather the raw addresses that preserve the lsb.
There was a problem hiding this comment.
they aren't though its a 3-tuple of name, address, original_address
|
Verified that this fixes the issue for |
|
My original implementation used a custom parser to pull that data out. I ended up discarding that in favor of this approach so that we specifically did not have to maintain two ELF parsers. IMO this is a better solution than duplicating all the parse logic. |
This fixes ARM/Thumb .gnu_debugdata loading by preserving the original mini-debug symbol address before ELF symbol normalization clears the Thumb bit.
For ARM/Thumb binaries, the parent ELF load passes an internal load option to the embedded mini-debug ELF load. The child ELF records metadata only for function symbols whose normalized address differs from the original symbol address. The parent then reads that metadata from the returned mini-debug BinaryView and uses the original address to recover the associated platform, while still defining the symbol at the normalized address.
This keeps the extra metadata work limited to ARM/Thumb binaries with .gnu_debugdata, avoids re-parsing the embedded ELF, and does not expose the temporary metadata on the final parent view.