<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Feb 24, 2011, at 11:52 AM, Devang Patel wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><br>On Feb 24, 2011, at 11:36 AM, Devang Patel wrote:<br><br><blockquote type="cite"><br></blockquote><blockquote type="cite">On Feb 12, 2011, at 2:07 AM, Nathan Jeffords wrote:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite">Hello All,<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">I have created a set of patches that get dwarf debugging support working for the COFF object file. I also believe I have fixed what appears to be a bug in how line info sections are referred to from the DW_TAG_compile_unit DIE. I have run some basic tests, analyzed dumps of both the objects files and the final executables, and run a test program against mingw-gdb and everything looks to be in order.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Here is a short description of what the patches accomplish<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">die.patch:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> adds a new DIEValue type to represent a section relative label. (their was already a type id specified so I provided a class modeled after DIELabel)<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">secrel-fixup.patch:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> creats a new target specific fixup type (reloc_coff_secrel32) to represent COFF Section Relative relocations and updats the COFF object writer to write it as COFF_IMAGE_REL_AMD64_SREL32<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">secrel-streamer.patch<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> adds a new directive in the MCStreamer interface to allow the AsmPrinter to emit a section relative label and provides implementations for all existings Streamer (all but WinCOFF either forward or error on it)<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">secrel-dwarf.patch<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> updates dwarf printing code to make use of the new directive & DIE value where appropriate (this is where the bug fix is)<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">coff-debug.patch<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> turns the dwarf output on in the X86/COFF AsmInfo classes<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">This patches look fine. I am curious, how are you testing debug info support for COFF ?<br></blockquote><br>Well, this patch fails following FE tests on darwin.<br>    LLVM :: FrontendC++/2006-11-06-StackTrace.cpp<br>    LLVM :: FrontendC++/2006-11-30-Pubnames.cpp<br>    LLVM :: FrontendC++/2010-08-31-ByValArg.cpp<br>    LLVM :: FrontendC/2009-02-17-BitField-dbg.c<br>    LLVM :: FrontendC/2010-01-14-StaticVariable.c<br>    LLVM :: FrontendC/2010-02-16-DbgVarScope.c<br>    LLVM :: FrontendObjC/2009-08-17-DebugInfo.m<font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#144FAE"><br></font></font></div></blockquote><br></div><div>This is because of </div><br><div><div>@@ -1903,7 +1912,8 @@</div><div>     addLabel(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_addr,</div><div>              Asm->GetTempSymbol("section_line"));</div><div>   else</div><div>-    addUInt(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_data4, 0);</div><div>+    addSectionOffset(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_addr,</div><div>+             Asm->GetTempSymbol("section_line"));</div><div> </div><div>   if (!Dir.empty())</div><div>     addString(Die, dwarf::DW_AT_comp_dir, dwarf::DW_FORM_string, Dir);</div></div><div><br></div><div><br></div><div>You probably wanted  to do...</div><div><br></div><div><div>@@ -1904,8 +1913,8 @@</div><div>   // DW_AT_stmt_list is a offset of line number information for this</div><div>   // compile unit in debug_line section.</div><div>   if (Asm->MAI->doesDwarfUsesAbsoluteLabelForStmtList())</div><div>-    addLabel(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_addr,</div><div>-             Asm->GetTempSymbol("section_line"));</div><div>+    addSectionOffset(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_addr,</div><div>+                     Asm->GetTempSymbol("section_line"));</div><div>   else</div><div>     addUInt(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_data4, 0);</div><div> </div></div><div><br></div><div>I updated this part and applied your patch. r126425</div><div>Thanks for the contribution!</div><div>-</div><div>Devang</div></body></html>