<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)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><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:0cm;
        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
        {mso-style-priority:99;
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        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";}
p.msochpdefault, li.msochpdefault, div.msochpdefault
        {mso-style-name:msochpdefault;
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Calibri","sans-serif";}
span.emailstyle17
        {mso-style-name:emailstyle17;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
span.EmailStyle23
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
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-IE" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">Hi Swarp,<o:p></o:p></span></p>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black"><br>
</span><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:#1F497D">></span><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black"> clang -g -O2 -o .libs/mergedexe .libs/mergedbc.bc -pthread -Wl,--export-dynamic   .libs/lib1.a
   -lssl -lcrypto –ldl –pthread .libs/lib2.so</span><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="color:#1F497D">Thanks. This works fine. The project that I am migrating is huge and has various massive Makefiles. But I am going to try this 3 step approach to apply passes and compile the code.
 If that gets too complex then I will move to GoldPlugin. <o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="color:#1F497D">Thanks.<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="color:#1F497D">--Ahmad<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black"><br>
<br>
-Swarup.<o:p></o:p></span></p>
<div>
<div class="MsoNormal" align="center" style="text-align:center"><span style="font-size:12.0pt;font-family:"Times New Roman","serif";color:black">
<hr size="2" width="100%" align="center">
</span></div>
<div id="divRpF111692">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black"> 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</span><span style="font-size:12.0pt;font-family:"Times New Roman","serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="color:black">Hi All,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">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:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><b><span style="color:black">Original Makefile- Object Files based Build/Link Steps:
</span></b><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">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 
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><b><span style="color:black">Proposed Makefile- LLVM Bitcode based Build/Link Steps:</span></b><span style="color:black"><o:p></o:p></span></p>
<p class="MsoListParagraph" style="margin-left:18.0pt;text-indent:-18.0pt"><span style="color:black">1.</span><span style="font-size:7.0pt;font-family:"Times New Roman","serif";color:black">      
</span><span style="color:black">llvm-link -o .libs/mergedbc.bc   file1.bc    file2.bc   file3.bc<o:p></o:p></span></p>
<p class="MsoListParagraph" style="margin-left:18.0pt;text-indent:-18.0pt"><span style="color:black">2.</span><span style="font-size:7.0pt;font-family:"Times New Roman","serif";color:black">      
</span><span style="color:black">opt  –o  optmerged.bc  -load /path/to/Mypass.so  -mypass <  mergedbc.bc<o:p></o:p></span></p>
<p class="MsoListParagraph" style="margin-left:18.0pt;text-indent:-18.0pt"><span style="color:black">3.</span><span style="font-size:7.0pt;font-family:"Times New Roman","serif";color:black">      
</span><span style="color:black">llc  -o .libs/mergedbc.s    .libs/mergedbc.bc<o:p></o:p></span></p>
<p class="MsoListParagraph" style="margin-left:18.0pt;text-indent:-18.0pt"><span style="color:black">4.</span><span style="font-size:7.0pt;font-family:"Times New Roman","serif";color:black">      
</span><span style="color:black">gcc -g -O2 -o .libs/mergedexe  .libs/mergedbc.s  -pthread -Wl,--export-dynamic   .libs/lib1.a   -lssl -lcrypto –ldl –pthread .libs/lib2.so<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">Thanks.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">Ahmad<o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>