<html 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=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@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;}
/* 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;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.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>
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">LLD uses a mix of assembly test cases (using llvm-mc) and YAML test cases (using yaml2obj).<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-left:.5in"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">llvm-commits <llvm-commits-bounces@lists.llvm.org> on behalf of David Blaikie via llvm-commits <llvm-commits@lists.llvm.org><br>
<b>Reply-To: </b>David Blaikie <dblaikie@gmail.com><br>
<b>Date: </b>Monday, August 20, 2018 at 1:06 PM<br>
<b>To: </b>"lhamesATgmail.com" <lhames@gmail.com><br>
<b>Cc: </b>Commit Messages and Patches for LLVM <llvm-commits@lists.llvm.org><br>
<b>Subject: </b>Re: [llvm] r338975 - [ORC] Remove an incorrect use of 'cantFail'.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:.5in">
<o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal" style="margin-left:.5in">On Fri, Aug 17, 2018 at 12:43 PM Lang Hames <<a href="mailto:lhames@gmail.com">lhames@gmail.com</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<p class="MsoNormal" style="margin-left:.5in">I think that once this functionality is exposed via lli/LLJIT it would be reasonable to have a regression test to verify that a bad object files trigger an error from the tool code.<o:p></o:p></p>
</div>
</blockquote>
<div>
<p class="MsoNormal" style="margin-left:.5in"><br>
So this is currently unreachable code? Could it remain an assertion, then, until it's added - so there's no chance of this slipping through untested? (this is generally the preferred approach in LLVM, I think - not adding unreachable/untestable code)<br>
 <o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<p class="MsoNormal" style="margin-left:.5in">This will be a New Thing for JIT API testing though: MCJIT and ORCv1 both notionally deal with bad object files, but never had tests for them. I assume it was just an aversion to checking in binary object-files
 for tests, but in this case we could just test with an empty object file.<o:p></o:p></p>
</div>
</blockquote>
<div>
<p class="MsoNormal" style="margin-left:.5in"><br>
There are a few projects/areas of LLVM that contend with that htese days - for instance I think lld's approach is to rely on llvm-mc to assemble assembly-written test cases into object files to then pass into the linker for testing. Other areas (like llvm-dwarfdump)
 have some checked in binary object files. I'm  undecided on the best approach here - certainly open to throwing around more ideas in that space.<br>
<br>
- Dave<br>
 <o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal" style="margin-left:.5in">-- Lang.<o:p></o:p></p>
</div>
</div>
</div>
</div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal" style="margin-left:.5in">On Thu, Aug 16, 2018 at 2:19 PM David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<p class="MsoNormal" style="mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:.5in">
<o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal" style="margin-left:.5in">On Thu, Aug 16, 2018 at 11:37 AM Lang Hames <<a href="mailto:lhames@gmail.com" target="_blank">lhames@gmail.com</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<p class="MsoNormal" style="margin-left:.5in">I'm not sure this particular case deserves a test case. Prior to the change, passing a valid object was a matter of contract.<o:p></o:p></p>
</div>
</blockquote>
<div>
<p class="MsoNormal" style="margin-left:.5in"><br>
Seems to me a test case demonstrating that the program behaves as expected when an invalid object is passed, now that that's a valid use-case is merited. Usual sort of LLVM test approach.<br>
<br>
Whether it's a unit test or an end-to-end test I don't have strong feelings about.<br>
 <o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<p class="MsoNormal" style="margin-left:.5in">After the change it is a trivial error-propagation, and we don't usually test them at every level of the stack.
<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">I would like to see more "bad object" tests for libObject itself, but that's outside the scope of this patch.<o:p></o:p></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">-- Lang.<o:p></o:p></p>
</div>
</div>
</div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal" style="margin-left:.5in">On Mon, Aug 6, 2018 at 8:47 PM David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<p class="MsoNormal" style="margin-left:.5in">Test case?<o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal" style="margin-left:.5in">On Sun, Aug 5, 2018 at 4:55 PM Lang Hames via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal" style="margin-left:.5in">Author: lhames<br>
Date: Sun Aug  5 16:55:35 2018<br>
New Revision: 338975<br>
<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D338975-26view-3Drev&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=A5jpUMBMrLqfc2BgsKejO-Ax_SIzu6atc0sVTEXzL9I&s=lqa9zdklyH9I4i9I9bnpOHwdRI0U3BURIT6khgRrfNw&e=" target="_blank">
http://llvm.org/viewvc/llvm-project?rev=338975&view=rev</a><br>
Log:<br>
[ORC] Remove an incorrect use of 'cantFail'.<br>
<br>
This code was moved out from BasicObjectLayerMaterializationUnit, which required<br>
the supplied object to be well formed. The getObjectSymbolFlags function does<br>
not require a well-formed object, so we have to propagate the error here.<br>
<br>
Modified:<br>
    llvm/trunk/lib/ExecutionEngine/Orc/Layer.cpp<br>
<br>
Modified: llvm/trunk/lib/ExecutionEngine/Orc/Layer.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_ExecutionEngine_Orc_Layer.cpp-3Frev-3D338975-26r1-3D338974-26r2-3D338975-26view-3Ddiff&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=A5jpUMBMrLqfc2BgsKejO-Ax_SIzu6atc0sVTEXzL9I&s=TZoBRRi_6KJ5MjqLdpL5CSHBxgfrPJVab8-gbwqmnwA&e=" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/Layer.cpp?rev=338975&r1=338974&r2=338975&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/ExecutionEngine/Orc/Layer.cpp (original)<br>
+++ llvm/trunk/lib/ExecutionEngine/Orc/Layer.cpp Sun Aug  5 16:55:35 2018<br>
@@ -116,8 +116,10 @@ Expected<SymbolFlagsMap> getObjectSymbol<br>
   for (auto &Sym : (*Obj)->symbols()) {<br>
     if (!(Sym.getFlags() & object::BasicSymbolRef::SF_Undefined) &&<br>
         (Sym.getFlags() & object::BasicSymbolRef::SF_Exported)) {<br>
-      auto InternedName =<br>
-          ES.getSymbolStringPool().intern(cantFail(Sym.getName()));<br>
+      auto Name = Sym.getName();<br>
+      if (!Name)<br>
+        return Name.takeError();<br>
+      auto InternedName = ES.getSymbolStringPool().intern(*Name);<br>
       auto SymFlags = JITSymbolFlags::fromObjectSymbol(Sym);<br>
       if (!SymFlags)<br>
         return SymFlags.takeError();<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_llvm-2Dcommits&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=A5jpUMBMrLqfc2BgsKejO-Ax_SIzu6atc0sVTEXzL9I&s=q9RRbZi9bLl2b-mZnpFl0vG1ET8Mj8i2Mlwq6S6Uyew&e=" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><o:p></o:p></p>
</blockquote>
</div>
</blockquote>
</div>
</blockquote>
</div>
</div>
</blockquote>
</div>
</blockquote>
</div>
</div>
</div>
</body>
</html>