hth313 / Calypsi-tool-chains

Overview of the Calypsi tool chain and open source support packages
16 stars 0 forks source link

Potential Debug information corruption in the example\minimal object file #30

Open djipi opened 1 year ago

djipi commented 1 year ago

Using the Calypsi 4.4 example\minimal project to check the object file content.

Used dwarfdump and readelf tools to check/dump the object file and tools reported error in the obj.

By example, dwarfdump --check-all reported: "ERROR: Failure reading CU header or DIE, corrupt DWARF: DW_DLE_RELOC_SECTION_RELOC_TARGET_SIZE_UNKNOWN (233) so doing a relocation is unsafe. Attempting to continue."

hth313 commented 11 months ago

I have no idea what the problem is here. The CU (compilation unit) record in DWARF does not appear to have any attribute that talks about relocations or sizes of such.

As far as I understand, a relocation is a mechanism to change a value in the output file based on placement of sections. It is a concern for the object file format (ELF in this case) and is not something that belongs to DWARF. Relocations can alter values (addresses) in DWARF sections as needed, but that is a mechanism related to ELF and the linker. Debug information (DWARF sections) are mostly passed through with minimal processing in the linker for performance and is intended for consumption in the debugger (if program is loaded in a debugger).

For some operating systems lacking virtual memory relocations can also be applied at load time, examples are AmigaOS, TOS and (I believe) Apple IIgs.

Is it possible to find further details on what the problem is here?

djipi commented 11 months ago

I do not have much to add at the moment. I just used the project found in Calypsi-68k-4.4\example\minimal, and I wanted to have a look at the ELF/DWARF information. I used dwarfdump and readelf tools, which are commons tools to read obj files.

I use a 68000 based platform, without Operating System.