pret / agbcc

C compiler
104 stars 75 forks source link

(Optional) fix for .debug_line head generation #51

Closed StanHash closed 1 year ago

StanHash commented 2 years ago

Sometimes when using tools for reading line number information out of objects generated by agbcc, you'd get the follwing error:

DWARF error: mangled line number section

This is presumably caused by the function size_of_line_info (in gcc/dwarf2out.c) sometimes mispredicting the actual size of the rest of the .debug_line section. This was fixed here by generating label deltas instead of using that function (as is done in more recent versions of GCC).

The optional -ffix-debug-line flag enables this new behavior.

Note: that fix probably needs to eventually be ported to agbcc_arm as well as any fork featuring agbcp.


I'm only now seeing that there's another debug info related PR in (#49) featuring the addition of a new flag. Perhaps it would be interesting to merge the flags into an unified one that either updates/fixes debug info generation or restores the old buggy one.

laqieer commented 2 years ago

https://github.com/gcc-mirror/gcc/commit/14a774a9d22db91fb6387cb8eb61060b61782f29 reference for code review

StanHash commented 1 year ago

Updated this to not enable new fixed behavior by default.