Dear all, sorry to bother you. I am new to llvm, and have a trivial question. When I compile the original source code to llvm-IR, there is an error as follows: $ llvm-gcc hello.c -o hello /tmp/cc1vOzRT.s: Assembler messages: /tmp/cc1vOzRT.s:9: Error: suffix or operands invalid for `push' /tmp/cc1vOzRT.s:21: Error: suffix or operands invalid for `pop' -------------------------------------------- #include <stdio.h> int main() { printf("hello world\n"); return 0; } ------------------------------------------ $ uname -a Linux localhost.localdomain 2.6.25.11-97.fc9.x86_64 #1 SMP Mon Jul 21 01:09:10 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux THANK YOU!
How did you compile LLVM? Can you please 'file lvm-gcc'? 2009/3/16 bq chan <cbqios at gmail.com>:> Dear all, sorry to bother you. > I am new to llvm, and have a trivial question. When I compile the > original source code to llvm-IR, there is an error as follows: > > $ llvm-gcc hello.c -o hello > /tmp/cc1vOzRT.s: Assembler messages: > /tmp/cc1vOzRT.s:9: Error: suffix or operands invalid for `push' > /tmp/cc1vOzRT.s:21: Error: suffix or operands invalid for `pop' > > -------------------------------------------- > #include <stdio.h> > > int main() { > printf("hello world\n"); > return 0; > } > ------------------------------------------ > $ uname -a > Linux localhost.localdomain 2.6.25.11-97.fc9.x86_64 #1 SMP Mon Jul 21 > 01:09:10 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux > > > THANK YOU! > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >
Thank you. I just downloaded the binaries... Maybe I should compile it in my PC. I'll have a try. Thanks. $ file llvm-gcc llvm-gcc: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.2.5, not stripped 2009/3/16 someguy <just.s0m3.guy+llvmdev at gmail.com>:> How did you compile LLVM? > > Can you please 'file lvm-gcc'? > > 2009/3/16 bq chan <cbqios at gmail.com>: >> Dear all, sorry to bother you. >> I am new to llvm, and have a trivial question. When I compile the >> original source code to llvm-IR, there is an error as follows: >> >> $ llvm-gcc hello.c -o hello >> /tmp/cc1vOzRT.s: Assembler messages: >> /tmp/cc1vOzRT.s:9: Error: suffix or operands invalid for `push' >> /tmp/cc1vOzRT.s:21: Error: suffix or operands invalid for `pop' >> >> -------------------------------------------- >> #include <stdio.h> >> >> int main() { >> printf("hello world\n"); >> return 0; >> } >> ------------------------------------------ >> $ uname -a >> Linux localhost.localdomain 2.6.25.11-97.fc9.x86_64 #1 SMP Mon Jul 21 >> 01:09:10 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux >> >> >> THANK YOU! >> >> >> _______________________________________________ >> 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 > >
The code generated is 32 bit, so your assembler does not like it. You have two options. a) tell llvm-gcc to call the assembler and linker for 32 bit binaries. b) tell llvm-gcc to emit llvm code (llvm-gcc --emit-llvm -c -o foo.bc foo.c) and then compile the bitcode to 64bit binary with llc (llc - march=x86-64 -o foo foo.bc) Anthony On Mar 16, 2009, at 3:28 AM, bq chan wrote:> Dear all, sorry to bother you. > I am new to llvm, and have a trivial question. When I compile the > original source code to llvm-IR, there is an error as follows: > > $ llvm-gcc hello.c -o hello > /tmp/cc1vOzRT.s: Assembler messages: > /tmp/cc1vOzRT.s:9: Error: suffix or operands invalid for `push' > /tmp/cc1vOzRT.s:21: Error: suffix or operands invalid for `pop' > > -------------------------------------------- > #include <stdio.h> > > int main() { > printf("hello world\n"); > return 0; > } > ------------------------------------------ > $ uname -a > Linux localhost.localdomain 2.6.25.11-97.fc9.x86_64 #1 SMP Mon Jul 21 > 01:09:10 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux > > > THANK YOU! > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev