Hi, this is a short progress report (with a current patch ontop of the debug-early branch attached).
So I worked towards making regular non-LTO mode output DWARF in two stages, early (before .text) and late (after .text). I've also prototyped the LTO side (BLOCK support still missing) to show what breaks in dwarf2out.c - only -flto-partition=none is currently supported because I'm lazy. Also only a single CU ;) What works is the following C testcase: typedef int Mint; struct X { Mint res; }; int main(int argc, char **argv) { { struct X x; x.res = 0; Mint res = x.res; return res; } } and the following C++ testcase: class X { public: X(int r) : res(r) {} int get() { return res; } private: int res; }; int main() { X x(0); return x.get (); } they work in the non-LTO mode only (well, didn't check the LTO side yet). Work means I can debug them with gdb (7.9 tested) and the DWARF looks like I expect it to look for LTO. There is no support yet in the LTO driver (so the early debuginfo section will be missing in the final object), but I currently ICE always anyway. The late dwarf generation doesn't quite work in an ideal way (sharing the central dwarf2out_decl path ... :/), but well. Richard.
early-lto-debug-day1
Description: Binary data