<div id="docBody" class="docBody" style="word-wrap: break-word; margin: 10px;">
<style id="mysingle_style" type="text/css">p { margin-top: 5px; font-size: 9pt; margin-bottom: 5px; font-family: Arial,arial; }td { margin-top: 5px; font-size: 9pt; margin-bottom: 5px; font-family: Arial,arial; }li { margin-top: 5px; font-size: 9pt; margin-bottom: 5px; font-family: Arial,arial; }body { font-size: 9pt; margin: 10px; line-height: 1.4; font-family: Arial,arial; }</style>
<p style="line-height: 150%;"><b style=""> </b>Hello,</p>
<p style="line-height: 150%;">I am using llvm-2.7 to run a native(executable) on a arm processor.</p><p style="line-height: 150%;">I have built my wxGtk sample app with llvm-gcc as frontend .</p>
<p style="line-height: 150%;">I am using llvm-2.7 and llvm-gcc-4.2.</p>
<p style="line-height: 150%;">I built llvm-2.7 <span style=""> </span><span style=""> </span>with:</p>
<p style="line-height: 150%;">../llvm-2.7/configure --prefix=/home/install-llvm <span style=""> </span>--enable-optimized --enable-assertions</p>
<p style="line-height: 150%;">and llvm gcc with:</p>
<p style="line-height: 150%;">../llvm-gcc-4.2-2.7.source/configure
--prefix=/home//gcc-disable-shared --enable-languages=c++,c
--enable-checking --enable-llvm=/home/ llvm-objects --disable-bootstrap
--disable-multilib</p>Now from Samples, I am compiling minimal.cpp by llvm-gcc (binary for x86) using the following commands:<br>
<p style="line-height: 150%;"><b style="">Step 1. llvm-gcc -O3 -emit-llvm minimal.cpp -c -o minimal.bc `wxconfig –cxxflags`</b></p>
<p style="line-height: 150%;"><b style="">Step 2. llc minimal.bc<span style=""> </span>–march=arm –o minimal.s<span style=""> </span>(</b>for generating arm assembly code<b style="">)</b></p>
<p style="line-height: 150%;"><b style="">Step 3 arm_v7_vfp_le-gcc minimal.s –o minimal.native `wxconfig –libs` (</b>arm compiler to compile this assembly code into native executable<b style="">)</b></p>
<p style="line-height: 150%;">Now when I am running this native
executable on my target it is crashing in g_object new(). However, if I
build my application(wxGTK application) with a memory allocation using
new in the very start, the same exe now would run successfully. </p>
<p style="line-height: 150%;">For your reference I am posting both the codes:<br><br><b>Case 1: Crash</b> at a point when it tries to allocate memory in making an object of MyFrame in the code below.<br>bool MyApp::OnInit()<br>
{ <br> if ( !wxApp::OnInit() )<br> return false;<br> // create the main application window<br> MyFrame *frame = new MyFrame(_T("Minimal wxWidgets App")); <br> frame->Show(true);<br>
return true;<br>}<br><br><b>Case 2</b>: The code below is same as above except the first line in the function body and it <b>runs fine</b> .<br>bool MyApp::OnInit()<br>{<br> <b> char *ptr = new char[10000];</b><br>
if ( !wxApp::OnInit() )<br> return false;<br> // create the main application window<br> MyFrame *frame = new MyFrame(_T("Minimal wxWidgets App")); <br> frame->Show(true);<br>
return true;<br>}<br><br>Can anybody give us an explanation for this??</p>
<p style="line-height: 150%;">How does using <b>new </b>in the start makes a difference?? <br></p>
<p> </p>
<p>Thanks & Regards,<br></p><p>Ankur Jain</p><p>Senior Software Engineer</p><p> </p>
<p> </p>
<p> </p>
<p> </p>
<table id="confidentialsignimg">
<tbody>
<tr>
<td>
<p><img alt="" src="http://v6.samsung.net/service/ml/AttachController/201012031730447_2LL5XOK0.jpg?cmd=downdirectly&filepath=/LOCAL/ML/CACHE/j/20101203/LK7CT9SZN3WZ@namo.co.kr20101203120015519@smita.gjain.a&contentType=IMAGE/JPEG;charset=windows-1252&msgno=38&partno=1&foldername=INBOX" border="0" width="520"></p>
</td></tr></tbody></table>
<p><br></p>
<br>
</div>
<form id="detail2Form" name="detail2Form" action="">
<input name="cmd" value="" type="hidden">
<input name="foldername" value="" type="hidden">
<input name="msguid" value="" type="hidden">
<input name="recipientsInfo" value="N" type="hidden">
<input name="recipientsTelInfo" value="Y" type="hidden">
<input name="zoomsize" value="" type="hidden">
<input name="linesize" value="" type="hidden">
</form>
<form name="pollForm" action="/service/poll/PollMailingController" method="post">
<input name="cmd" type="hidden">
<input name="code" type="hidden">
</form>
<form name="bdForm" action="/service/bd/myApprove" method="post">
<input name="cmd" type="hidden">
<input name="targetCmd" type="hidden">
<input name="SERVLET_NAME" type="hidden">
<input name="SERVICE_TYPE" type="hidden">
<input name="approveFlag" type="hidden">
<input name="boardCode" type="hidden">
<input name="companyCode" type="hidden">
<input name="seqNum" type="hidden">
<input name="approveComment" type="hidden">
</form>
<div style="height: 6px;" id="flexContainer" class="flexContainer">
</div>