Tommy Chheng
2009-Nov-20 06:47 UTC
[LLVMdev] llvm code working on linux but not mac, 64 bit problem?
Hi, Learning the ropes of LLVM. I have this simple LLVM assembly snippet which compiles/runs fine in Ubuntu but won't work on snow leopard. Somehow related to 64-bit? Anyone else experience this? llvm-as if.ll llc -f if.bc gcc -o if if.s ld: 32-bit pointer out of range in _main from /var/folders/TY/TYHT2tSJEcaVdUEWeuX5P++++TI/-Tmp-//cck44HlB.o collect2: ld returned 1 exit status -------- @s = internal constant [4 x i8] c"%d\0A\00" declare i32 @printf(i8 *, ...) define i32 @main() nounwind { entry: %x = alloca i32 %x.0 = add i32 0, 5 %t1 = icmp sgt i32 %x.0, 0 br i1 %t1, label %thenLabel1, label %elseLabel2 thenLabel1: %x.1 = add i32 2, %x.0 br label %joinIfLabel3 elseLabel2: %x.2 = add i32 3, %x.0 br label %joinIfLabel3 joinIfLabel3: %x.3 = phi i32 [%x.1, %thenLabel1],[%x.2, %elseLabel2] tail call i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]* @s, i64 0, i64 0), i32 %x.3) nounwind ret i32 0 } -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091119/412cbc0b/attachment.html>
Timo Juhani Lindfors
2009-Nov-20 07:50 UTC
[LLVMdev] llvm code working on linux but not mac, 64 bit problem?
Tommy Chheng <tommy.chheng at gmail.com> writes:> Learning the ropes of LLVM. I have this simple LLVM assembly snippet > which compiles/runs fine in Ubuntu but won't work on snow > leopard. Somehow related to 64-bit? Anyone else experience this?Works on my 64-bit debian system so it's not totally broken on 64-bit systems.
Harmen van der Spek
2009-Nov-20 07:52 UTC
[LLVMdev] llvm code working on linux but not mac, 64 bit problem?
It runs fine on my Snow Leopard installation. I do recall though that LLVM did not build in 64-bit mode automatically. I configured LLVM as follows to get a 64-bit build. ./configure --build=x86_64-apple-darwin10 --host=x86_64-apple-darwin10 --target=x86_64-apple-darwin1 Harmen Tommy Chheng wrote:> Hi, > Learning the ropes of LLVM. I have this simple LLVM assembly snippet > which compiles/runs fine in Ubuntu but won't work on snow leopard. > Somehow related to 64-bit? Anyone else experience this? > > llvm-as if.ll > llc -f if.bc > gcc -o if if.s > ld: 32-bit pointer out of range in _main from > /var/folders/TY/TYHT2tSJEcaVdUEWeuX5P++++TI/-Tmp-//cck44HlB.o > collect2: ld returned 1 exit status > > -------- > > @s = internal constant [4 x i8] c"%d\0A\00" > declare i32 @printf(i8 *, ...) > > define i32 @main() nounwind { > > entry: > %x = alloca i32 > %x.0 = add i32 0, 5 > %t1 = icmp sgt i32 %x.0, 0 > br i1 %t1, label %thenLabel1, label %elseLabel2 > > thenLabel1: > %x.1 = add i32 2, %x.0 > br label %joinIfLabel3 > > elseLabel2: > %x.2 = add i32 3, %x.0 > br label %joinIfLabel3 > > joinIfLabel3: > %x.3 = phi i32 [%x.1, %thenLabel1],[%x.2, %elseLabel2] > tail call i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]* @s, i64 > 0, i64 0), i32 %x.3) nounwind > ret i32 0 > } > > > ------------------------------------------------------------------------ > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Tommy Chheng
2009-Nov-20 17:20 UTC
[LLVMdev] llvm code working on linux but not mac, 64 bit problem?
I re-compiled LLVM with the parameters and it's working. Thanks! Tommy On 11/19/09 11:52 PM, Harmen van der Spek wrote:> It runs fine on my Snow Leopard installation. I do recall though > that LLVM did not build in 64-bit mode automatically. I configured > LLVM as follows to get a 64-bit build. > > ./configure --build=x86_64-apple-darwin10 --host=x86_64-apple-darwin10 > --target=x86_64-apple-darwin1 > > Harmen > > Tommy Chheng wrote: > >> Hi, >> Learning the ropes of LLVM. I have this simple LLVM assembly snippet >> which compiles/runs fine in Ubuntu but won't work on snow leopard. >> Somehow related to 64-bit? Anyone else experience this? >> >> llvm-as if.ll >> llc -f if.bc >> gcc -o if if.s >> ld: 32-bit pointer out of range in _main from >> /var/folders/TY/TYHT2tSJEcaVdUEWeuX5P++++TI/-Tmp-//cck44HlB.o >> collect2: ld returned 1 exit status >> >> -------- >> >> @s = internal constant [4 x i8] c"%d\0A\00" >> declare i32 @printf(i8 *, ...) >> >> define i32 @main() nounwind { >> >> entry: >> %x = alloca i32 >> %x.0 = add i32 0, 5 >> %t1 = icmp sgt i32 %x.0, 0 >> br i1 %t1, label %thenLabel1, label %elseLabel2 >> >> thenLabel1: >> %x.1 = add i32 2, %x.0 >> br label %joinIfLabel3 >> >> elseLabel2: >> %x.2 = add i32 3, %x.0 >> br label %joinIfLabel3 >> >> joinIfLabel3: >> %x.3 = phi i32 [%x.1, %thenLabel1],[%x.2, %elseLabel2] >> tail call i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]* @s, i64 >> 0, i64 0), i32 %x.3) nounwind >> ret i32 0 >> } >> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
Reasonably Related Threads
- [LLVMdev] llvm code working on linux but not mac, 64 bit problem?
- [LLVMdev] Getting the DSNode from a Pool Descriptor?
- [LLVMdev] Getting the DSNode from a Pool Descriptor?
- [LLVMdev] Getting the DSNode from a Pool Descriptor?
- [LLVMdev] Getting the DSNode from a Pool Descriptor?