summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCDwarf.cpp
diff options
context:
space:
mode:
authorPaul Robinson <paul.robinson@sony.com>2018-03-06 03:15:21 +0000
committerPaul Robinson <paul.robinson@sony.com>2018-03-06 03:15:21 +0000
commit732e443bb9eebf5ba1a9dbf0df1104057b8fa2ac (patch)
tree7c68da8169bdcb4fed36bfd21290d33ff3a7ddfc /llvm/lib/MC/MCDwarf.cpp
parent8fd561f572b8992f3e1b94192e0285fbd237636b (diff)
downloadbcm5719-llvm-732e443bb9eebf5ba1a9dbf0df1104057b8fa2ac.tar.gz
bcm5719-llvm-732e443bb9eebf5ba1a9dbf0df1104057b8fa2ac.zip
Revert "[DWARFv5] Emit file 0 to the line table."
Caused an asan failure. This reverts commit d54883f081186cdcce74e6f98cfc0438579ec019. aka r326758 llvm-svn: 326762
Diffstat (limited to 'llvm/lib/MC/MCDwarf.cpp')
-rw-r--r--llvm/lib/MC/MCDwarf.cpp61
1 files changed, 27 insertions, 34 deletions
diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp
index ee675acd530..685b46a606d 100644
--- a/llvm/lib/MC/MCDwarf.cpp
+++ b/llvm/lib/MC/MCDwarf.cpp
@@ -346,34 +346,6 @@ void MCDwarfLineTableHeader::emitV2FileDirTables(MCStreamer *MCOS) const {
MCOS->EmitIntValue(0, 1); // Terminate the file list.
}
-static void emitOneV5FileEntry(MCStreamer *MCOS, const MCDwarfFile &DwarfFile,
- bool HasMD5, bool HasSource,
- Optional<MCDwarfLineStr> &LineStr) {
- assert(!DwarfFile.Name.empty());
- if (LineStr)
- LineStr->emitRef(MCOS, DwarfFile.Name);
- else {
- MCOS->EmitBytes(DwarfFile.Name); // FileName and...
- MCOS->EmitBytes(StringRef("\0", 1)); // its null terminator.
- }
- MCOS->EmitULEB128IntValue(DwarfFile.DirIndex); // Directory number.
- if (HasMD5) {
- MD5::MD5Result *Cksum = DwarfFile.Checksum;
- MCOS->EmitBinaryData(
- StringRef(reinterpret_cast<const char *>(Cksum->Bytes.data()),
- Cksum->Bytes.size()));
- }
- if (HasSource) {
- if (LineStr)
- LineStr->emitRef(MCOS, DwarfFile.Source.getValueOr(StringRef()));
- else {
- MCOS->EmitBytes(
- DwarfFile.Source.getValueOr(StringRef())); // Source and...
- MCOS->EmitBytes(StringRef("\0", 1)); // its null terminator.
- }
- }
-}
-
void MCDwarfLineTableHeader::emitV5FileDirTables(
MCStreamer *MCOS, Optional<MCDwarfLineStr> &LineStr) const {
// The directory format, which is just a list of the directory paths. In a
@@ -422,12 +394,33 @@ void MCDwarfLineTableHeader::emitV5FileDirTables(
MCOS->EmitULEB128IntValue(LineStr ? dwarf::DW_FORM_line_strp
: dwarf::DW_FORM_string);
}
- // Then the counted list of files. The root file is file #0, then emit the
- // files as provide by .file directives.
- MCOS->EmitULEB128IntValue(MCDwarfFiles.size());
- emitOneV5FileEntry(MCOS, RootFile, HasMD5, HasSource, LineStr);
- for (unsigned i = 1; i < MCDwarfFiles.size(); ++i)
- emitOneV5FileEntry(MCOS, MCDwarfFiles[i], HasMD5, HasSource, LineStr);
+ // Then the list of file names. These start at 1.
+ MCOS->EmitULEB128IntValue(MCDwarfFiles.size() - 1);
+ for (unsigned i = 1; i < MCDwarfFiles.size(); ++i) {
+ assert(!MCDwarfFiles[i].Name.empty());
+ if (LineStr)
+ LineStr->emitRef(MCOS, MCDwarfFiles[i].Name);
+ else {
+ MCOS->EmitBytes(MCDwarfFiles[i].Name); // FileName and...
+ MCOS->EmitBytes(StringRef("\0", 1)); // its null terminator.
+ }
+ MCOS->EmitULEB128IntValue(MCDwarfFiles[i].DirIndex); // Directory number.
+ if (HasMD5) {
+ MD5::MD5Result *Cksum = MCDwarfFiles[i].Checksum;
+ MCOS->EmitBinaryData(
+ StringRef(reinterpret_cast<const char *>(Cksum->Bytes.data()),
+ Cksum->Bytes.size()));
+ }
+ if (HasSource) {
+ if (LineStr)
+ LineStr->emitRef(MCOS, MCDwarfFiles[i].Source.getValueOr(StringRef()));
+ else {
+ MCOS->EmitBytes(
+ MCDwarfFiles[i].Source.getValueOr(StringRef())); // Source and...
+ MCOS->EmitBytes(StringRef("\0", 1)); // its null terminator.
+ }
+ }
+ }
}
std::pair<MCSymbol *, MCSymbol *>
OpenPOWER on IntegriCloud