binutils-ia16 icon indicating copy to clipboard operation
binutils-ia16 copied to clipboard

DWARF2 debug support patches + default i8086 arch (binutils side)

Open asiekierka opened this issue 3 years ago • 2 comments

This merge request hopes to achieve two things:

  • Add and use a default "i8086" architecture - this removes the need to specify -m i8086 in certain objdump calls, and also is necessary to effectively achieve the next point,
  • Fix DWARF2 data alignment for IA-16.

This is a draft pull request, as while DWARF2 debug data is emitted, at least with regards to types and line numbers (with the proper GCC patch - see matching gcc-ia16 PR), and it looks correct to my eye, something still appears broken. (However, I do not think this is a blocker for potentially merging this PR, as no regressions are caused to my eye - while the GCC-side PR is dependent on the binutils-side PR, the opposite is not the case.)

asiekierka avatar Dec 21 '22 20:12 asiekierka

I'm un-drafting this PR, as I have triaged the issue but need help figuring out a fix.

The issue which remains is with R_386_SUB32 relocations in segelf mode corrupting the debug sections' addresses. GCC primarily emits 32-bit relocations in i8086 builds as part of DWARF debug data; however, these pointers must point to the "linear" memory address of the symbol, and not the offset of the symbol. This is an issue in tc_gen_reloc, most likely, but I'm not familiar enough with binutils internals to have an idea of how to best fix this.

asiekierka avatar Aug 17 '23 06:08 asiekierka

Also, if you'd prefer to receive merge requests on GitLab or Codeberg instead, please let me know and I'll do my best to move my upstreaming efforts there going forward.

asiekierka avatar Aug 17 '23 06:08 asiekierka