[PATCH] D43002: Emit S_OBJNAME symbol in CodeView

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 6 19:33:56 PST 2018


zturner created this revision.
zturner added a reviewer: rnk.
Herald added a reviewer: deadalnix.
Herald added subscribers: hiraditya, aprantl.

We've had a longstanding incompatibility with MSVC where we don't emit a couple of CodeView records that normally go in each file.  This patch aims to address the first of these records - the `S_OBJNAME` symbol.  This symbol is very simple.  It just contains the full path to the object file that the debug info is being emitted to.

However, getting that information into the backend is not so easy.  The approach taken here is to add an extra field to `CodeGenOpts`, and then get it into the `DICompileUnit`.  This in turn led to a bunch of additional fallout such as having to change one of the llvm c api methods.  If someone has a suggestion for how to mitigate this, or if they think I should just undo all of that stuff entirely, let me know and I'm happy to oblige.

One minor quirk of this functionality is that when we use `-emit-llvm`, there actually is no object file.  The object file is only decided later when someone runs `llc` on the assembly.  Still though, for the purposes of testing, I just manually edited the output of `clang -emit-llvm` to add an `outputFile: "t.cpp.obj"` to the `DICompileUnit`.

Open to other ideas as well.


https://reviews.llvm.org/D43002

Files:
  clang/include/clang/Frontend/CodeGenOptions.h
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  llvm/include/llvm-c/DebugInfo.h
  llvm/include/llvm/IR/DIBuilder.h
  llvm/include/llvm/IR/DebugInfoMetadata.h
  llvm/lib/AsmParser/LLParser.cpp
  llvm/lib/Bitcode/Reader/MetadataLoader.cpp
  llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
  llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
  llvm/lib/IR/DIBuilder.cpp
  llvm/lib/IR/DebugInfo.cpp
  llvm/lib/IR/DebugInfoMetadata.cpp
  llvm/test/DebugInfo/COFF/buildinfo.ll
  llvm/tools/llvm-c-test/debuginfo.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43002.133138.patch
Type: text/x-patch
Size: 23895 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180207/a712a934/attachment.bin>


More information about the llvm-commits mailing list