<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Aug 9, 2016, at 8:17 PM, Robinson, Paul <<a href="mailto:paul.robinson@sony.com" class="">paul.robinson@sony.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="WordSection1" style="page: WordSection1; font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div style="margin: 0in 0in 0.0001pt 0.5in; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">Otherwise you can also do something like what Kevin had in mind: ask LTOCodeGenerator to produce the bitcode before the backend and exit the linker process at this point, then run llc on it to get the assembly, assemble it, and re-invoke the linker.<span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><a name="_MailEndCompose" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">Or feed the emitted bitcode back into clang, without –flto, which would let you use all the normal clang ways to decide what kind of output you want. (Clang will accept .bc or .ll files as input.)  This also has the support advantage of not introducing developer tools into your application build workflow; whether this is important to you depends on who your users are and what tools you normally deliver to them.  (llc is generally not considered a tool appropriate to end-users.)</span></a></div></div></div></blockquote><div><br class=""></div><div>Very good point indeed.</div><div><br class=""></div><div>— </div><div>Mehdi</div><div><span style="color: rgb(31, 73, 125); font-family: Calibri, sans-serif; font-size: 11pt;" class=""><br class=""></span></div><div><span style="color: rgb(31, 73, 125); font-family: Calibri, sans-serif; font-size: 11pt;" class=""> </span></div><blockquote type="cite" class=""><div class="WordSection1" style="page: WordSection1; font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div style="border-style: none none none solid; border-left-color: blue; border-left-width: 1.5pt; padding: 0in 0in 0in 4pt;" class=""><div class=""><div style="border-style: solid none none; border-top-color: rgb(181, 196, 223); border-top-width: 1pt; padding: 3pt 0in 0in;" class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><b class=""><span style="font-size: 10pt; font-family: Tahoma, sans-serif;" class="">From:</span></b><span style="font-size: 10pt; font-family: Tahoma, sans-serif;" class=""><span class="Apple-converted-space"> </span>llvm-dev [<a href="mailto:llvm-dev-bounces@lists.llvm.org" class="">mailto:llvm-dev-bounces@lists.llvm.org</a>]<span class="Apple-converted-space"> </span><b class="">On Behalf Of<span class="Apple-converted-space"> </span></b>Mehdi Amini via llvm-dev<br class=""><b class="">Sent:</b><span class="Apple-converted-space"> </span>Tuesday, August 09, 2016 9:53 AM<br class=""><b class="">To:</b><span class="Apple-converted-space"> </span>Kevin Choi<br class=""><b class="">Cc:</b><span class="Apple-converted-space"> </span>LLVM Developers Mailing List<br class=""><b class="">Subject:</b><span class="Apple-converted-space"> </span>Re: [llvm-dev] [LTO] Bypass the integrated assembler ...<o:p class=""></o:p></span></div></div></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><o:p class=""> </o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><o:p class=""> </o:p></div><div class=""><blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">On Aug 9, 2016, at 9:24 AM, Kevin Choi via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" style="color: purple; text-decoration: underline;" class="">llvm-dev@lists.llvm.org</a>> wrote:<o:p class=""></o:p></div></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><o:p class=""> </o:p></div><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">-Wl,--plugin=LLVMgold.so,--plugin-opt=emit-llvm<o:p class=""></o:p></div></div></div></blockquote><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><o:p class=""> </o:p></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">This is totally Gold specific. The fact that he mentions using LTOCodeGenerator makes me think that he does not use Gold.<o:p class=""></o:p></div></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><br class=""><br class=""><o:p class=""></o:p></div><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><br class=""><a href="http://llvm.org/docs/CommandGuide/opt.html" target="_blank" style="color: purple; text-decoration: underline;" class="">http://llvm.org/docs/CommandGuide/opt.html</a><br class=""><a href="http://llvm.org/docs/CommandGuide/llc.html" target="_blank" style="color: purple; text-decoration: underline;" class="">http://llvm.org/docs/CommandGuide/llc.html</a><br class=""><br class="">"The<span class="Apple-converted-space"> </span><strong class="">llc</strong><span class="Apple-converted-space"> </span>command compiles LLVM source inputs into assembly language for a specified architecture."<o:p class=""></o:p></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><o:p class=""> </o:p></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">On 9 August 2016 at 04:16, Umesh Kalappa via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" style="color: purple; text-decoration: underline;" class="">llvm-dev@lists.llvm.org</a>> wrote:<o:p class=""></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">Hi Guys ,<br class=""><br class="">We enabled the LTO on our code base and found that LTO uses the<br class="">integrated/builtin assembler to emit the final optimized code .O<br class="">(FileType= CGFT_ObjectFile) .<br class=""><br class="">Can we bypass this semantic ,for something like you emit .S  file<br class="">(FileType=CGFT_AssemblyFile),<br class=""><br class="">Then we pass this  .S file to our native assembler and  the linker<br class="">.....any switch/ options  do so ?<br class=""><br class="">i.e  something like as we have   "-no-integrated-as" for clang driver .<br class=""><br class="">Currently ,we thought of hacking the LTOCodeGenerator.cpp for the same .<br class=""><br class="">The bottom-line is that ,we need to use our native assembler ,not the builtin .<br class=""><br class="">Any thoughts on this ?<o:p class=""></o:p></div></div></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><o:p class=""> </o:p></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">Unfortunately there is no “ready-to-use” way, clang has a driver that can dump intermediate file (here the .s) and invoke a chain of commands. The linker plugin is not designed this way, it is invoked by the linker and given the input bitcode will produce one or multiple object files for the linker.<o:p class=""></o:p></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">What you want to do could be achieved by hacking the LTOCodeGenerator and do something like use posix_spawn and pipes to invoke your assembler.<o:p class=""></o:p></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">Otherwise you can also do something like what Kevin had in mind: ask LTOCodeGenerator to produce the bitcode before the backend and exit the linker process at this point, then run llc on it to get the assembly, assemble it, and re-invoke the linker. This is probably less convenient if you need to integrate with a build system.<o:p class=""></o:p></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><o:p class=""> </o:p></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">— <o:p class=""></o:p></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">Mehdi</div></div></div></div></div></blockquote></div><br class=""></body></html>