goblin
goblin copied to clipboard
Don't return an error when some section are not correct
I have a debug file (IBM935.so.debug) which contains some incorrect info in dynamic section and so the section failed to be parsed with error Invalid PT_DYNAMIC size (offset 0x14db0, filesz 0x1f0) (offset & section come from the .so file and in this file they're correct).
The problem is that I don't care at all about this section and I'd be fine to have dynamic: None in my Elf object.
So would it be possible to not return an error or at least have a way to configure the way to handle errors ?
A possibility is to have an Option< Result > for dynamic field and so let people handle errors like they want. Wdyt ?
what is the .debug file? is it additional dwarf debug information? Who produced it? Just wondering why the PT_DYNAMIC is incorrect; that's usually pretty bad. We could potentially make these changes but it would be a breaking change. Would like more information about what's going on (maybe the .debug file is just bad, e.g., and we shouldn't support it); can other tools parse this file, e.g., nm, objdump, etc.?
The files are taken from this debuginfo package. One thing worth noting is that this file and other two from Fedora's glibc package exhibit this behavior and always did so in previous releases too, going back at least to Fedora 30. So it's not some kind of bug that was introduced recently.
nm and objdump both seem able to process the file but both print an empty dynamic section and no symbols. dwarfdump also doesn't seem to fail when processing the file and prints out the debug information. Looking at the DW_AT_producer entries the source was a mix of C and assembly files built with the following:
- GNU C11 10.1.1 20200507 (Red Hat 10.1.1-1) -m64 -mtune=generic -march=x86-64 -g -O2 -std=gnu11 -fgnu89-inline -fasynchronous-unwind-tables -fstack-clash-protection -fmerge-all-constants -frounding-math -fstack-protector-strong -fmath-errno -fPIC -fcf-protection=full -fplugin=annobin
- GNU AS 2.34