ankur jain
2010-Dec-03 12:16 UTC
[LLVMdev] wxGTK sample app compiled by llvm crashes on arm
* *Hello, I am using llvm-2.7 to run a native(executable) on a arm processor. I have built my wxGtk sample app with llvm-gcc as frontend . I am using llvm-2.7 and llvm-gcc-4.2. I built llvm-2.7 with: ../llvm-2.7/configure --prefix=/home/install-llvm --enable-optimized --enable-assertions and llvm gcc with: ../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 Now from Samples, I am compiling minimal.cpp by llvm-gcc (binary for x86) using the following commands: *Step 1. llvm-gcc -O3 -emit-llvm minimal.cpp -c -o minimal.bc `wxconfig –cxxflags`* *Step 2. llc minimal.bc –march=arm –o minimal.s (*for generating arm assembly code*)* *Step 3 arm_v7_vfp_le-gcc minimal.s –o minimal.native `wxconfig –libs` (*arm compiler to compile this assembly code into native executable*)* 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. For your reference I am posting both the codes: *Case 1: Crash* at a point when it tries to allocate memory in making an object of MyFrame in the code below. bool MyApp::OnInit() { if ( !wxApp::OnInit() ) return false; // create the main application window MyFrame *frame = new MyFrame(_T("Minimal wxWidgets App")); frame->Show(true); return true; } *Case 2*: The code below is same as above except the first line in the function body and it *runs fine* . bool MyApp::OnInit() { * char *ptr = new char[10000];* if ( !wxApp::OnInit() ) return false; // create the main application window MyFrame *frame = new MyFrame(_T("Minimal wxWidgets App")); frame->Show(true); return true; } Can anybody give us an explanation for this?? How does using *new *in the start makes a difference?? Thanks & Regards, Ankur Jain Senior Software Engineer -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101203/e3c6213f/attachment.html>
Anton Korobeynikov
2010-Dec-03 13:01 UTC
[LLVMdev] wxGTK sample app compiled by llvm crashes on arm
> I am using llvm-2.7 to run a native(executable) on a arm processor.ARM was pretty much broken in 2.7. Consider using at least 2.8> ../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-multilibYou have to configure llvm-gcc as cross-arm compiler.> Step 1. llvm-gcc -O3 -emit-llvm minimal.cpp -c -o minimal.bc `wxconfig –cxxflags` > Step 2. llc minimal.bc –march=arm –o minimal.s (for generating arm assembly code)This won't work. You're trying to codegen x86 IR for ARM. -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University
ankur jain
2010-Dec-06 06:52 UTC
[LLVMdev] wxGTK sample app compiled by llvm crashes on arm
Thanx for a prompt reply. I will definitely try llvm 2.8 as per your suggestion. However Step 1 and Step 2 are working for me in case of a simple hello world program on arm processor . Similarly I am able to run a GTK application on arm. However while running wxGTKwidget app it crashes while allocation of memory. As I mentioned earlier, If I explicitly allocate memory using new operation then everything works fine. Please let me know why do we actually fail without using new, that to a arbitrary pointer which is never used in the program. On Fri, Dec 3, 2010 at 6:31 PM, Anton Korobeynikov <anton at korobeynikov.info>wrote:> > I am using llvm-2.7 to run a native(executable) on a arm processor. > ARM was pretty much broken in 2.7. Consider using at least 2.8 > > > ../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 > You have to configure llvm-gcc as cross-arm compiler. > > > Step 1. llvm-gcc -O3 -emit-llvm minimal.cpp -c -o minimal.bc `wxconfig > –cxxflags` > > Step 2. llc minimal.bc –march=arm –o minimal.s (for generating arm > assembly code) > This won't work. You're trying to codegen x86 IR for ARM. > > -- > With best regards, Anton Korobeynikov > Faculty of Mathematics and Mechanics, Saint Petersburg State University >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101206/86a4904f/attachment.html>
Maybe Matching Threads
- [LLVMdev] wxGTK sample app compiled by llvm crashes on arm
- [LLVMdev] wxGTK sample app compiled by llvm crashes on arm
- [LLVMdev] wxGTK sample app compiled by llvm crashes on arm
- [LLVMdev] Fwd: wxGTK sample app compiled by llvm crashes on arm
- [LLVMdev] wxGTK sample app compiled by llvm crashes on arm