summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCDwarf.cpp
diff options
context:
space:
mode:
authorPaul Robinson <paul.robinson@sony.com>2018-07-10 14:41:54 +0000
committerPaul Robinson <paul.robinson@sony.com>2018-07-10 14:41:54 +0000
commitc17c8bf749e8c9c8e452e4b9cf669e8edf9461de (patch)
treeb5e375b17ad4b398d258a21bb804f6a639ea86af /llvm/lib/MC/MCDwarf.cpp
parent3333106a6248635accab6d5b8c2f737ba5d06e6d (diff)
downloadbcm5719-llvm-c17c8bf749e8c9c8e452e4b9cf669e8edf9461de.tar.gz
bcm5719-llvm-c17c8bf749e8c9c8e452e4b9cf669e8edf9461de.zip
Support -fdebug-prefix-map in llvm-mc. This is useful to omit the
debug compilation dir when compiling assembly files with -g. Part of PR38050. Patch by Siddhartha Bagaria! Differential Revision: https://reviews.llvm.org/D48988 llvm-svn: 336680
Diffstat (limited to 'llvm/lib/MC/MCDwarf.cpp')
-rw-r--r--llvm/lib/MC/MCDwarf.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp
index 37e1263be65..1d33d9947be 100644
--- a/llvm/lib/MC/MCDwarf.cpp
+++ b/llvm/lib/MC/MCDwarf.cpp
@@ -250,8 +250,11 @@ void MCDwarfLineTable::Emit(MCObjectStreamer *MCOS,
MCOS->SwitchSection(context.getObjectFileInfo()->getDwarfLineSection());
// Handle the rest of the Compile Units.
- for (const auto &CUIDTablePair : LineTables)
- CUIDTablePair.second.EmitCU(MCOS, Params, LineStr);
+ for (const auto &CUIDTablePair : LineTables) {
+ auto &LineTable = context.getMCDwarfLineTable(CUIDTablePair.first);
+ LineTable.RemapDwarfDirs(MCOS->getContext());
+ LineTable.EmitCU(MCOS, Params, LineStr);
+ }
if (LineStr)
LineStr->emitSection(MCOS);
@@ -394,13 +397,13 @@ void MCDwarfLineTableHeader::emitV5FileDirTables(
if (LineStr) {
// Record path strings, emit references here.
LineStr->emitRef(MCOS, CompDir);
- for (auto &Dir : MCDwarfDirs)
+ for (const auto &Dir : MCDwarfDirs)
LineStr->emitRef(MCOS, Dir);
} else {
// The list of directory paths. Compilation directory comes first.
MCOS->EmitBytes(CompDir);
MCOS->EmitBytes(StringRef("\0", 1));
- for (auto &Dir : MCDwarfDirs) {
+ for (const auto &Dir : MCDwarfDirs) {
MCOS->EmitBytes(Dir); // The DirectoryName, and...
MCOS->EmitBytes(StringRef("\0", 1)); // its null terminator.
}
@@ -631,6 +634,11 @@ MCDwarfLineTableHeader::tryGetFile(StringRef &Directory,
return FileNumber;
}
+void MCDwarfLineTable::RemapDwarfDirs(MCContext &Context) {
+ for (auto &Dir : Header.MCDwarfDirs)
+ Context.RemapDebugPath(&Dir);
+}
+
/// Utility function to emit the encoding to a streamer.
void MCDwarfLineAddr::Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,
int64_t LineDelta, uint64_t AddrDelta) {
OpenPOWER on IntegriCloud