Support for XC16/PIC phantom bytes #522
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Addresses #518 and #473.
This is a weird flavor of DWARF, emitted by the XC16 compiler for PIC microcontrollers, that looks completely alien on its face but can be trivially supported if one discards every odd numbered byte ("phantom bytes") in every DWARF section.
We don't know where does this transform fit between two decompression hooks and relocations. Relocations are explicitly shorted out for now, the compression logic is left as-is, seeing as the compiler doesn't seem to support it.
This peculiarity adds nothing to the format of DWARF proper, it can be seen as merely an unusual way to store DWARF data in the binary. So a case for a proper readelf test is not as strong as I originally thought; a unit test with an XC16/PIC binary should suffice. Before the patch, parsing those binaries would crash on the first CU accessing call.