aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
diff options
context:
space:
mode:
authorAlexandre Ganea <alexandre.ganea@legionlabs.com>2021-12-21 18:59:47 -0500
committerAlexandre Ganea <alexandre.ganea@legionlabs.com>2021-12-21 19:02:14 -0500
commita282ea4898efe2b2e57a93b44e90c9e497520cfb (patch)
tree57c90bccf41dd205db8b8b1aa7b187057a55a074 /llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
parent5bb5142e80c9c6eb1a948d6d2ff4834e4e69741f (diff)
downloadllvm-a282ea4898efe2b2e57a93b44e90c9e497520cfb.zip
llvm-a282ea4898efe2b2e57a93b44e90c9e497520cfb.tar.gz
llvm-a282ea4898efe2b2e57a93b44e90c9e497520cfb.tar.bz2
Reland - [CodeView] Emit S_OBJNAME record
Reland integrates build fixes & further review suggestions. Thanks to @zturner for the initial S_OBJNAME patch! Differential Revision: https://reviews.llvm.org/D43002
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
index 928252a..d621108 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -649,6 +649,7 @@ void CodeViewDebug::endModule() {
switchToDebugSectionForSymbol(nullptr);
MCSymbol *CompilerInfo = beginCVSubsection(DebugSubsectionKind::Symbols);
+ emitObjName();
emitCompilerInformation();
endCVSubsection(CompilerInfo);
@@ -784,6 +785,29 @@ void CodeViewDebug::emitTypeGlobalHashes() {
}
}
+void CodeViewDebug::emitObjName() {
+ MCSymbol *CompilerEnd = beginSymbolRecord(SymbolKind::S_OBJNAME);
+
+ StringRef PathRef(Asm->TM.Options.ObjectFilenameForDebug);
+ llvm::SmallString<256> PathStore(PathRef);
+
+ if (PathRef.empty() || PathRef == "-") {
+ // Don't emit the filename if we're writing to stdout or to /dev/null.
+ PathRef = {};
+ } else {
+ llvm::sys::path::remove_dots(PathStore, /*remove_dot_dot=*/true);
+ PathRef = PathStore;
+ }
+
+ OS.AddComment("Signature");
+ OS.emitIntValue(0, 4);
+
+ OS.AddComment("Object name");
+ emitNullTerminatedSymbolName(OS, PathRef);
+
+ endSymbolRecord(CompilerEnd);
+}
+
namespace {
struct Version {
int Part[4];