<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Looks like that was building r322394, should already be fixed in r322400. Let me know if it isn't.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">--paulr<o:p></o:p></span></p>
<p class="MsoNormal"><a name="_MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></a></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> mzolotukhin@apple.com [mailto:mzolotukhin@apple.com]
<br>
<b>Sent:</b> Friday, January 12, 2018 4:40 PM<br>
<b>To:</b> Robinson, Paul<br>
<b>Cc:</b> llvm-commits@lists.llvm.org<br>
<b>Subject:</b> Re: [llvm] r322391 - [DWARFv5] CodeGen support for MD5 file checksums<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Hi,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal">This broke green dragon build [1]. Could you please take a look?<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Thanks,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Michael<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">[1] <a href="http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/45621/consoleFull#-144947796949ba4694-19c4-4d7e-bec5-911270d8a58c">http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/45621/consoleFull#-144947796949ba4694-19c4-4d7e-bec5-911270d8a58c</a><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
<div>
<p class="MsoNormal">On Jan 12, 2018, at 11:17 AM, Paul Robinson via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">Author: probinson<br>
Date: Fri Jan 12 11:17:50 2018<br>
New Revision: 322391<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=322391&view=rev">http://llvm.org/viewvc/llvm-project?rev=322391&view=rev</a><br>
Log:<br>
[DWARFv5] CodeGen support for MD5 file checksums<br>
<br>
Pass MD5 checksums through from IR to assembly/object files.<br>
After this, getting Clang to compute the MD5 should be the last step<br>
to supporting MD5 in the DWARF v5 line table header.<br>
<br>
Differential Revision: <a href="https://reviews.llvm.org/D41926">https://reviews.llvm.org/D41926</a><br>
<br>
Added:<br>
llvm/trunk/test/CodeGen/Generic/dwarf-md5.ll<br>
Modified:<br>
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp<br>
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h<br>
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br>
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp<br>
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h<br>
llvm/trunk/lib/MC/MCAsmStreamer.cpp<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=322391&r1=322390&r2=322391&view=diff">
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=322391&r1=322390&r2=322391&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Fri Jan 12 11:17:50 2018<br>
@@ -94,17 +94,17 @@ void DwarfCompileUnit::addLocalLabelAddr<br>
DIEInteger(0));<br>
}<br>
<br>
-unsigned DwarfCompileUnit::getOrCreateSourceID(StringRef FileName,<br>
- StringRef DirName,<br>
- MD5::MD5Result *Checksum) {<br>
+unsigned DwarfCompileUnit::getOrCreateSourceID(const DIFile *File) {<br>
// If we print assembly, we can't separate .file entries according to<br>
// compile units. Thus all files will belong to the default compile unit.<br>
<br>
// FIXME: add a better feature test than hasRawTextSupport. Even better,<br>
// extend .file to support this.<br>
+ unsigned CUID = Asm->OutStreamer->hasRawTextSupport() ? 0 : getUniqueID();<br>
+ if (!File)<br>
+ return Asm->OutStreamer->EmitDwarfFileDirective(0, "", "", nullptr, CUID);<br>
return Asm->OutStreamer->EmitDwarfFileDirective(<br>
- 0, DirName, FileName, Checksum,<br>
- Asm->OutStreamer->hasRawTextSupport() ? 0 : getUniqueID());<br>
+ 0, File->getDirectory(), File->getFilename(), getMD5AsBytes(File), CUID);<br>
}<br>
<br>
DIE *DwarfCompileUnit::getOrCreateGlobalVariableDIE(<br>
@@ -444,7 +444,7 @@ DIE *DwarfCompileUnit::constructInlinedS<br>
// Add the call site information to the DIE.<br>
const DILocation *IA = Scope->getInlinedAt();<br>
addUInt(*ScopeDIE, dwarf::DW_AT_call_file, None,<br>
- getOrCreateSourceID(IA->getFilename(), IA->getDirectory(), nullptr));<br>
+ getOrCreateSourceID(IA->getFile()));<br>
addUInt(*ScopeDIE, dwarf::DW_AT_call_line, None, IA->getLine());<br>
if (IA->getDiscriminator() && DD->getDwarfVersion() >= 4)<br>
addUInt(*ScopeDIE, dwarf::DW_AT_GNU_discriminator, None,<br>
@@ -688,9 +688,7 @@ DIE *DwarfCompileUnit::constructImported<br>
else<br>
EntityDie = getDIE(Entity);<br>
assert(EntityDie);<br>
- auto *File = Module->getFile();<br>
- addSourceLine(*IMDie, Module->getLine(), File ? File->getFilename() : "",<br>
- File ? File->getDirectory() : "");<br>
+ addSourceLine(*IMDie, Module->getLine(), Module->getFile());<br>
addDIEEntry(*IMDie, dwarf::DW_AT_import, *EntityDie);<br>
StringRef Name = Module->getName();<br>
if (!Name.empty())<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h?rev=322391&r1=322390&r2=322391&view=diff">
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h?rev=322391&r1=322390&r2=322391&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h Fri Jan 12 11:17:50 2018<br>
@@ -141,8 +141,7 @@ public:<br>
<br>
DwarfCompileUnit &getCU() override { return *this; }<br>
<br>
- unsigned getOrCreateSourceID(StringRef FileName, StringRef DirName,<br>
- MD5::MD5Result *Checksum) override;<br>
+ unsigned getOrCreateSourceID(const DIFile *File) override;<br>
<br>
void addImportedEntity(const DIImportedEntity* IE) {<br>
DIScope *Scope = IE->getScope();<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=322391&r1=322390&r2=322391&view=diff">
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=322391&r1=322390&r2=322391&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Fri Jan 12 11:17:50 2018<br>
@@ -1366,19 +1366,17 @@ void DwarfDebug::endFunctionImpl(const M<br>
void DwarfDebug::recordSourceLine(unsigned Line, unsigned Col, const MDNode *S,<br>
unsigned Flags) {<br>
StringRef Fn;<br>
- StringRef Dir;<br>
unsigned Src = 1;<br>
unsigned Discriminator = 0;<br>
if (auto *Scope = cast_or_null<DIScope>(S)) {<br>
Fn = Scope->getFilename();<br>
- Dir = Scope->getDirectory();<br>
if (Line != 0 && getDwarfVersion() >= 4)<br>
if (auto *LBF = dyn_cast<DILexicalBlockFile>(Scope))<br>
Discriminator = LBF->getDiscriminator();<br>
<br>
unsigned CUID = Asm->OutStreamer->getContext().getDwarfCompileUnitID();<br>
Src = static_cast<DwarfCompileUnit &>(*InfoHolder.getUnits()[CUID])<br>
- .getOrCreateSourceID(Fn, Dir, nullptr);<br>
+ .getOrCreateSourceID(Scope->getFile());<br>
}<br>
Asm->OutStreamer->EmitDwarfLocDirective(Src, Line, Col, Flags, 0,<br>
Discriminator, Fn);<br>
@@ -1973,11 +1971,7 @@ void DwarfDebug::emitMacroFile(DIMacroFi<br>
assert(F.getMacinfoType() == dwarf::DW_MACINFO_start_file);<br>
Asm->EmitULEB128(dwarf::DW_MACINFO_start_file);<br>
Asm->EmitULEB128(F.getLine());<br>
- DIFile *File = F.getFile();<br>
- unsigned FID =<br>
- U.getOrCreateSourceID(File->getFilename(), File->getDirectory(),<br>
- nullptr); // FIXME: MD5?<br>
- Asm->EmitULEB128(FID);<br>
+ Asm->EmitULEB128(U.getOrCreateSourceID(F.getFile()));<br>
handleMacroNodes(F.getElements(), U);<br>
Asm->EmitULEB128(dwarf::DW_MACINFO_end_file);<br>
}<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp?rev=322391&r1=322390&r2=322391&view=diff">
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp?rev=322391&r1=322390&r2=322391&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp Fri Jan 12 11:17:50 2018<br>
@@ -19,6 +19,7 @@<br>
#include "llvm/ADT/APFloat.h"<br>
#include "llvm/ADT/APInt.h"<br>
#include "llvm/ADT/None.h"<br>
+#include "llvm/ADT/StringExtras.h"<br>
#include "llvm/ADT/iterator_range.h"<br>
#include "llvm/CodeGen/MachineFunction.h"<br>
#include "llvm/CodeGen/MachineOperand.h"<br>
@@ -30,6 +31,7 @@<br>
#include "llvm/IR/GlobalValue.h"<br>
#include "llvm/IR/Metadata.h"<br>
#include "llvm/MC/MCAsmInfo.h"<br>
+#include "llvm/MC/MCContext.h"<br>
#include "llvm/MC/MCDwarf.h"<br>
#include "llvm/MC/MCSection.h"<br>
#include "llvm/MC/MCStreamer.h"<br>
@@ -263,12 +265,25 @@ void DwarfUnit::addSectionOffset(DIE &Di<br>
addUInt(Die, Attribute, dwarf::DW_FORM_data4, Integer);<br>
}<br>
<br>
-unsigned DwarfTypeUnit::getOrCreateSourceID(StringRef FileName,<br>
- StringRef DirName,<br>
- MD5::MD5Result *Checksum) {<br>
+MD5::MD5Result *DwarfUnit::getMD5AsBytes(const DIFile *File) {<br>
+ assert(File);<br>
+ if (File->getChecksumKind() != DIFile::CSK_MD5)<br>
+ return nullptr;<br>
+<br>
+ // Convert the string checksum to an MD5Result for the streamer.<br>
+ // The verifier validates the checksum so we assume it's okay.<br>
+ // An MD5 checksum is 16 bytes.<br>
+ std::string Checksum = fromHex(File->getChecksum());<br>
+ void *CKMem = Asm->OutStreamer->getContext().allocate(16, 1);<br>
+ memcpy(CKMem, Checksum.data(), 16);<br>
+ return reinterpret_cast<MD5::MD5Result *>(CKMem);<br>
+}<br>
+<br>
+unsigned DwarfTypeUnit::getOrCreateSourceID(const DIFile *File) {<br>
return SplitLineTable<br>
- ? SplitLineTable->getFile(DirName, FileName, Checksum)<br>
- : getCU().getOrCreateSourceID(FileName, DirName, Checksum);<br>
+ ? SplitLineTable->getFile(File->getDirectory(),<br>
+ File->getFilename(), getMD5AsBytes(File))<br>
+ : getCU().getOrCreateSourceID(File);<br>
}<br>
<br>
void DwarfUnit::addOpAddress(DIELoc &Die, const MCSymbol *Sym) {<br>
@@ -338,12 +353,11 @@ void DwarfUnit::addBlock(DIE &Die, dwarf<br>
Die.addValue(DIEValueAllocator, Attribute, Block->BestForm(), Block);<br>
}<br>
<br>
-void DwarfUnit::addSourceLine(DIE &Die, unsigned Line, StringRef File,<br>
- StringRef Directory) {<br>
+void DwarfUnit::addSourceLine(DIE &Die, unsigned Line, const DIFile *File) {<br>
if (Line == 0)<br>
return;<br>
<br>
- unsigned FileID = getOrCreateSourceID(File, Directory, nullptr);<br>
+ unsigned FileID = getOrCreateSourceID(File);<br>
assert(FileID && "Invalid file id");<br>
addUInt(Die, dwarf::DW_AT_decl_file, None, FileID);<br>
addUInt(Die, dwarf::DW_AT_decl_line, None, Line);<br>
@@ -352,32 +366,31 @@ void DwarfUnit::addSourceLine(DIE &Die,<br>
void DwarfUnit::addSourceLine(DIE &Die, const DILocalVariable *V) {<br>
assert(V);<br>
<br>
- addSourceLine(Die, V->getLine(), V->getScope()->getFilename(),<br>
- V->getScope()->getDirectory());<br>
+ addSourceLine(Die, V->getLine(), V->getFile());<br>
}<br>
<br>
void DwarfUnit::addSourceLine(DIE &Die, const DIGlobalVariable *G) {<br>
assert(G);<br>
<br>
- addSourceLine(Die, G->getLine(), G->getFilename(), G->getDirectory());<br>
+ addSourceLine(Die, G->getLine(), G->getFile());<br>
}<br>
<br>
void DwarfUnit::addSourceLine(DIE &Die, const DISubprogram *SP) {<br>
assert(SP);<br>
<br>
- addSourceLine(Die, SP->getLine(), SP->getFilename(), SP->getDirectory());<br>
+ addSourceLine(Die, SP->getLine(), SP->getFile());<br>
}<br>
<br>
void DwarfUnit::addSourceLine(DIE &Die, const DIType *Ty) {<br>
assert(Ty);<br>
<br>
- addSourceLine(Die, Ty->getLine(), Ty->getFilename(), Ty->getDirectory());<br>
+ addSourceLine(Die, Ty->getLine(), Ty->getFile());<br>
}<br>
<br>
void DwarfUnit::addSourceLine(DIE &Die, const DIObjCProperty *Ty) {<br>
assert(Ty);<br>
<br>
- addSourceLine(Die, Ty->getLine(), Ty->getFilename(), Ty->getDirectory());<br>
+ addSourceLine(Die, Ty->getLine(), Ty->getFile());<br>
}<br>
<br>
/* Byref variables, in Blocks, are declared by the programmer as "SomeType<br>
@@ -1164,10 +1177,8 @@ bool DwarfUnit::applySubprogramDefinitio<br>
// Look at the Decl's linkage name only if we emitted it.<br>
if (DD->useAllLinkageNames())<br>
DeclLinkageName = SPDecl->getLinkageName();<br>
- unsigned DeclID = getOrCreateSourceID(SPDecl->getFilename(),<br>
- SPDecl->getDirectory(), nullptr);<br>
- unsigned DefID =<br>
- getOrCreateSourceID(SP->getFilename(), SP->getDirectory(), nullptr);<br>
+ unsigned DeclID = getOrCreateSourceID(SPDecl->getFile());<br>
+ unsigned DefID = getOrCreateSourceID(SP->getFile());<br>
if (DeclID != DefID)<br>
addUInt(SPDie, dwarf::DW_AT_decl_file, None, DefID);<br>
<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h?rev=322391&r1=322390&r2=322391&view=diff">
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h?rev=322391&r1=322390&r2=322391&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h Fri Jan 12 11:17:50 2018<br>
@@ -207,8 +207,7 @@ public:<br>
void addBlock(DIE &Die, dwarf::Attribute Attribute, DIEBlock *Block);<br>
<br>
/// Add location information to specified debug information entry.<br>
- void addSourceLine(DIE &Die, unsigned Line, StringRef File,<br>
- StringRef Directory);<br>
+ void addSourceLine(DIE &Die, unsigned Line, const DIFile *File);<br>
void addSourceLine(DIE &Die, const DILocalVariable *V);<br>
void addSourceLine(DIE &Die, const DIGlobalVariable *G);<br>
void addSourceLine(DIE &Die, const DISubprogram *SP);<br>
@@ -306,10 +305,13 @@ protected:<br>
/// Create new static data member DIE.<br>
DIE *getOrCreateStaticMemberDIE(const DIDerivedType *DT);<br>
<br>
- /// Look up the source ID with the given directory and source file names. If<br>
- /// none currently exists, create a new ID and insert it in the line table.<br>
- virtual unsigned getOrCreateSourceID(StringRef File, StringRef Directory,<br>
- MD5::MD5Result *Checksum) = 0;<br>
+ /// Look up the source ID for the given file. If none currently exists,<br>
+ /// create a new ID and insert it in the line table.<br>
+ virtual unsigned getOrCreateSourceID(const DIFile *File) = 0;<br>
+<br>
+ /// If the \p File has an MD5 checksum, return it as an MD5Result<br>
+ /// allocated in the MCContext.<br>
+ MD5::MD5Result *getMD5AsBytes(const DIFile *File);<br>
<br>
/// Look in the DwarfDebug map for the MDNode that corresponds to the<br>
/// reference.<br>
@@ -359,8 +361,7 @@ class DwarfTypeUnit final : public Dwarf<br>
DwarfCompileUnit &CU;<br>
MCDwarfDwoLineTable *SplitLineTable;<br>
<br>
- unsigned getOrCreateSourceID(StringRef File, StringRef Directory,<br>
- MD5::MD5Result *Checksum) override;<br>
+ unsigned getOrCreateSourceID(const DIFile *File) override;<br>
bool isDwoUnit() const override;<br>
<br>
public:<br>
<br>
Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=322391&r1=322390&r2=322391&view=diff">
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=322391&r1=322390&r2=322391&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original)<br>
+++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Fri Jan 12 11:17:50 2018<br>
@@ -1109,6 +1109,10 @@ unsigned MCAsmStreamer::EmitDwarfFileDir<br>
OS1 << ' ';<br>
}<br>
PrintQuotedString(Filename, OS1);<br>
+ if (Checksum) {<br>
+ OS1 << " md5 ";<br>
+ PrintQuotedString(Checksum->digest(), OS1);<br>
+ }<br>
if (MCTargetStreamer *TS = getTargetStreamer()) {<br>
TS->emitDwarfFileDirective(OS1.str());<br>
} else {<br>
<br>
Added: llvm/trunk/test/CodeGen/Generic/dwarf-md5.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/dwarf-md5.ll?rev=322391&view=auto">
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/dwarf-md5.ll?rev=322391&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/Generic/dwarf-md5.ll (added)<br>
+++ llvm/trunk/test/CodeGen/Generic/dwarf-md5.ll Fri Jan 12 11:17:50 2018<br>
@@ -0,0 +1,49 @@<br>
+; MD5 checksums provided by IR should be passed through to asm.<br>
+; They'll be emitted to an object file only for DWARF 5 or later.<br>
+<br>
+; REQUIRES: object-emission<br>
+; RUN: %llc_dwarf -dwarf-version 4 -filetype=asm -o - %s | FileCheck %s --check-prefix=ASM<br>
+; RUN: %llc_dwarf -dwarf-version 5 -filetype=asm -o - %s | FileCheck %s --check-prefix=ASM<br>
+; RUN: %llc_dwarf -dwarf-version 4 -filetype=obj -o %t4.o %s<br>
+; RUN: llvm-dwarfdump -debug-line %t4.o | FileCheck %s --check-prefix=OBJ-4<br>
+; RUN: %llc_dwarf -dwarf-version 5 -filetype=obj -o %t5.o %s<br>
+; RUN: llvm-dwarfdump -debug-line %t5.o | FileCheck %s --check-prefix=OBJ-5<br>
+<br>
+; FIXME: Need to convey the MD5 for the primary source file.<br>
+; ASM: .file "t.c"{{$}}<br>
+; ASM: .file 1 "./t1.h" md5 "11111111111111111111111111111111"<br>
+; ASM: .file 2 "./t2.h" md5 "22222222222222222222222222222222"<br>
+<br>
+; OBJ-4: Dir Mod Time File Len File Name<br>
+; OBJ-4: file_names[ 1] 1 0x00000000 0x00000000 t1.h<br>
+; OBJ-4: file_names[ 2] 1 0x00000000 0x00000000 t2.h<br>
+<br>
+; OBJ-5: Dir MD5 Checksum File Name<br>
+; OBJ-5: file_names[ 1] 1 11111111111111111111111111111111 t1.h<br>
+; OBJ-5: file_names[ 2] 1 22222222222222222222222222222222 t2.h<br>
+<br>
+; ModuleID = 't.c'<br>
+source_filename = "t.c"<br>
+<br>
+@t1 = global i32 1, align 4, !dbg !0<br>
+@t2 = global i32 0, align 4, !dbg !6<br>
+<br>
+!llvm.dbg.cu = !{!2}<br>
+!llvm.module.flags = !{!11, !12, !13}<br>
+!llvm.ident = !{!14}<br>
+<br>
+!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())<br>
+!1 = distinct !DIGlobalVariable(name: "t1", scope: !2, file: !10, line: 1, type: !9, isLocal: false, isDefinition: true)<br>
+!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 7.0.0 (trunk 322159)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5)<br>
+!3 = !DIFile(filename: "t.c", directory: "/home/probinson/projects/scratch", checksumkind: CSK_MD5, checksum: "00000000000000000000000000000000")<br>
+!4 = !{}<br>
+!5 = !{!0, !6}<br>
+!6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression())<br>
+!7 = distinct !DIGlobalVariable(name: "t2", scope: !2, file: !8, line: 1, type: !9, isLocal: false, isDefinition: true)<br>
+!8 = !DIFile(filename: "./t2.h", directory: "/home/probinson/projects/scratch", checksumkind: CSK_MD5, checksum: "22222222222222222222222222222222")<br>
+!9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)<br>
+!10 = !DIFile(filename: "./t1.h", directory: "/home/probinson/projects/scratch", checksumkind: CSK_MD5, checksum: "11111111111111111111111111111111")<br>
+!11 = !{i32 2, !"Dwarf Version", i32 4}<br>
+!12 = !{i32 2, !"Debug Info Version", i32 3}<br>
+!13 = !{i32 1, !"wchar_size", i32 4}<br>
+!14 = !{!"clang version 7.0.0 (trunk 322159)"}<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><o:p></o:p></p>
</div>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
</body>
</html>