<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style>
<!--
@font-face
{font-family:Calibri}
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif"}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif"}
span.EmailStyle17
{font-family:"Calibri","sans-serif";
color:windowtext}
.MsoChpDefault
{font-family:"Calibri","sans-serif"}
@page WordSection1
{margin:72.0pt 72.0pt 72.0pt 72.0pt}
ol
{margin-bottom:0cm}
ul
{margin-bottom:0cm}
-->
</style><style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1" lang="EN-IE" link="blue" vlink="purple">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Hi Ahmad,<br>
<br>
If the Makefile contains only this command, then it is not worth spending time on GoldPlugin. If you are building a large project, then it will be simpler to use GoldPlugin.<br>
<br>
The steps you are using seem right. You can possibly combine the last two steps (3&4) using only 1 clang command.<br>
<br>
clang -g -O2 -o .libs/mergedexe .libs/mergedbc.bc -pthread -Wl,--export-dynamic .libs/lib1.a -lssl -lcrypto –ldl –pthread .libs/lib2.so<br>
<br>
-Swarup.<br>
<br>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div style="direction: ltr;" id="divRpF111692"><font color="#000000" face="Tahoma" size="2"><b>From:</b> llvmdev-bounces@cs.uiuc.edu [llvmdev-bounces@cs.uiuc.edu] on behalf of Hassan, Ahmad [ahmad.hassan@sap.com]<br>
<b>Sent:</b> Thursday, January 17, 2013 7:56 AM<br>
<b>To:</b> llvmdev@cs.uiuc.edu<br>
<b>Subject:</b> [LLVMdev] Migrate Project Build system to LLVM BitCode<br>
</font><br>
</div>
<div></div>
<div>
<div class="WordSection1">
<p class="MsoNormal">Hi All,</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">I am migrating a build system of an existing project from ‘Object files’ based executable generation to ‘LLVM Bitcode’ files based exe generation and applying OPT pass to LLVM Bitcode. I found out the following 4 step procedure. Please
let me know if this is the right procedure or is there any other easy way of doing it. I need to modify ‘Makefile’ accordingly. I read on some forums about GoldPlugin but I don’t know exactly if it would be useful here:</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><b>Original Makefile- Object Files based Build/Link Steps: </b>
</p>
<p class="MsoNormal">clang -g -O2 –o .libs/mergedexe file1.o file2.o file3.o -pthread -Wl,--export-dynamic .libs/lib1.a -lssl –ldl –pthread .libs/lib2.so
</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><b>Proposed Makefile- LLVM Bitcode based Build/Link Steps:</b></p>
<p class="MsoListParagraph" style="margin-left:18.0pt; text-indent:-18.0pt"><span style="">1.<span style="font:7.0pt "Times New Roman"">
</span></span>llvm-link -o .libs/mergedbc.bc file1.bc file2.bc file3.bc</p>
<p class="MsoListParagraph" style="margin-left:18.0pt; text-indent:-18.0pt"><span style="">2.<span style="font:7.0pt "Times New Roman"">
</span></span>opt –o optmerged.bc -load /path/to/Mypass.so -mypass < mergedbc.bc</p>
<p class="MsoListParagraph" style="margin-left:18.0pt; text-indent:-18.0pt"><span style="">3.<span style="font:7.0pt "Times New Roman"">
</span></span>llc -o .libs/mergedbc.s .libs/mergedbc.bc</p>
<p class="MsoListParagraph" style="margin-left:18.0pt; text-indent:-18.0pt"><span style="">4.<span style="font:7.0pt "Times New Roman"">
</span></span>gcc -g -O2 -o .libs/mergedexe .libs/mergedbc.s -pthread -Wl,--export-dynamic .libs/lib1.a -lssl -lcrypto –ldl –pthread .libs/lib2.so</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Thanks.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Ahmad</p>
</div>
</div>
</div>
</div>
</body>
</html>