<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=iso-8859-1">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"MS Mincho";
        panose-1:2 2 6 9 4 2 5 8 3 4;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@MS Mincho";
        panose-1:2 2 6 9 4 2 5 8 3 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-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-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@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">Hi Rafael, Duncan, Peter,<o:p></o:p></p>
<p class="MsoNormal">With r220732, when calling the Linker::Linker(Module *M) constructor, the default<o:p></o:p></p>
<p class="MsoNormal">diagnostic handler is set to use LLVMContext::diagnose(). Linker::Linker(Module *M)<o:p></o:p></p>
<p class="MsoNormal">is the constructor called by LTOCodeGenerator::LTOCodeGenerator() constructor. This<o:p></o:p></p>
<p class="MsoNormal">change is somewhat problematic for our LTO client, because we use a wrapper<o:p></o:p></p>
<p class="MsoNormal">executable to relay communications with the LTO library. LLVMContext::diagnose()<o:p></o:p></p>
<p class="MsoNormal">calls exit(1) on errors, which causes the wrapper executable to exit before the<o:p></o:p></p>
<p class="MsoNormal">linker gets a chance to do any clean-up. I was wondering whether the<o:p></o:p></p>
<p class="MsoNormal">LTOCodeGenerator is now expected to provide a non-exiting diagnostic handler (like<o:p></o:p></p>
<p class="MsoNormal">below), and whether/how the other LTO clients are affected (or not). Any advice?<o:p></o:p></p>
<p class="MsoNormal">Thanks,<o:p></o:p></p>
<p class="MsoNormal">- Gao<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">diff --git a/llvm/lib/LTO/LTOCodeGenerator.cpp b/llvm/lib/LTO/LTOCodeGenerator.c<o:p></o:p></p>
<p class="MsoNormal">index c7a50bc..20ab4a2 100644<o:p></o:p></p>
<p class="MsoNormal">--- a/llvm/lib/LTO/LTOCodeGenerator.cpp<o:p></o:p></p>
<p class="MsoNormal"><span lang="ES-AR">+++ b/llvm/lib/LTO/LTOCodeGenerator.cpp<o:p></o:p></span></p>
<p class="MsoNormal">@@ -75,7 +75,12 @@ const char* LTOCodeGenerator::getVersionString() {<o:p></o:p></p>
<p class="MsoNormal">}<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">LTOCodeGenerator::LTOCodeGenerator()<o:p></o:p></p>
<p class="MsoNormal">-    : Context(getGlobalContext()), IRLinker(new Module("ld-temp.o", Context)) {<o:p></o:p></p>
<p class="MsoNormal">+    : Context(getGlobalContext()), IRLinker(new Module("ld-temp.o", Context),<o:p></o:p></p>
<p class="MsoNormal"><span lang="ES-AR">+       [&](const DiagnosticInfo &DI) {<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="ES-AR">+         DiagnosticPrinterRawOStream DP(errs());<o:p></o:p></span></p>
<p class="MsoNormal">+         DI.print(DP);<o:p></o:p></p>
<p class="MsoNormal">+         errs() << "\n";<o:p></o:p></p>
<p class="MsoNormal">+       }) {<o:p></o:p></p>
<p class="MsoNormal">   initializeLTOPasses();<o:p></o:p></p>
<p class="MsoNormal">}<o:p></o:p></p>
</div>
</body>
</html>