Dale Johannesen schrieb:> On Sep 17, 2008, at 2:36 PMPDT, Michael Reichenbach wrote: >> No matter if I try " >> llvm-g++ a.cpp -c -emit-llvm >> " with "LLVM-GCC 4.2 Front End Binaries for Mingw32/x86" on Windows XP >> or if I am trying it on Ubuntu... >> >> Only the a.o file will be created without any error messages. The .bc >> file will not be created, do you know why? > > -emit-llvm doesn't change the default name for the -c output. > The .o file should be llvm binary IR; if you want it named .bc, use -o > a.bc > If you're starting out, probably -S -emit-llvm is more useful, you can > read that format.Ok, I understand so far. I have a partially working example now. llvm-g++ a.cpp -c -emit-llvm llvm-g++ b.cpp -c -emit-llvm llvm-link a.o b.o -o program.bc llc -march=c program.bc -o program.c gcc program.c program.c will contain some non-human generated code. But it doesn't compile with gcc. There is an error, gcc complaints about undefined reference to std::cout and such (the code was just a very small example with cout). It hasn't be converted into "C only" code, can you tell me why? Regards, -mr
Hello Michael, If you're just trying to run the code you can skip the llc and gcc states and go directly to lli. PowerPC and Intel x86 are the only architectures supported by the jit compiler right now but it should work fine from Windows. The C output backend needs some work since C isn't a low-level language enough to compile the abstractions of LLVM Assembly code. --Sam Crow --- On Wed, 9/17/08, Michael Reichenbach <michael_reichenbach at freenet.de> wrote:> From: Michael Reichenbach <michael_reichenbach at freenet.de> > Subject: Re: [LLVMdev] bc file only with llvm-gcc3? > To: "LLVM Developers Mailing List" <llvmdev at cs.uiuc.edu> > Date: Wednesday, September 17, 2008, 5:39 PM > Dale Johannesen schrieb: > > On Sep 17, 2008, at 2:36 PMPDT, Michael Reichenbach > wrote: > >> No matter if I try " > >> llvm-g++ a.cpp -c -emit-llvm > >> " with "LLVM-GCC 4.2 Front End Binaries > for Mingw32/x86" on Windows XP > >> or if I am trying it on Ubuntu... > >> > >> Only the a.o file will be created without any > error messages. The .bc > >> file will not be created, do you know why? > > > > -emit-llvm doesn't change the default name for the > -c output. > > The .o file should be llvm binary IR; if you want it > named .bc, use -o > > a.bc > > If you're starting out, probably -S -emit-llvm is > more useful, you can > > read that format. > > Ok, I understand so far. > > I have a partially working example now. > > llvm-g++ a.cpp -c -emit-llvm > llvm-g++ b.cpp -c -emit-llvm > llvm-link a.o b.o -o program.bc > llc -march=c program.bc -o program.c > gcc program.c > > program.c will contain some non-human generated code. But > it doesn't > compile with gcc. There is an error, gcc complaints about > undefined > reference to std::cout and such (the code was just a very > small example > with cout). > > It hasn't be converted into "C only" code, > can you tell me why? > > Regards, > -mr > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
On Wed, Sep 17, 2008 at 3:39 PM, Michael Reichenbach <michael_reichenbach at freenet.de> wrote:> program.c will contain some non-human generated code. But it doesn't > compile with gcc. There is an error, gcc complaints about undefined > reference to std::cout and such (the code was just a very small example > with cout). > > It hasn't be converted into "C only" code, can you tell me why?If your code uses the C++ library, you'll need to link it against a C++ library. That has nothing to do with the language of the code. -Eli
Nope, I planed to convert into C code, compilable with a C compiler. -mr Samuel Crow schrieb:> Hello Michael, > > If you're just trying to run the code you can skip the llc and gcc states and go directly to lli. PowerPC and Intel x86 are the only architectures supported by the jit compiler right now but it should work fine from Windows. The C output backend needs some work since C isn't a low-level language enough to compile the abstractions of LLVM Assembly code. > > --Sam Crow > > --- On Wed, 9/17/08, Michael Reichenbach <michael_reichenbach at freenet.de> wrote: > >> From: Michael Reichenbach <michael_reichenbach at freenet.de> >> Subject: Re: [LLVMdev] bc file only with llvm-gcc3? >> To: "LLVM Developers Mailing List" <llvmdev at cs.uiuc.edu> >> Date: Wednesday, September 17, 2008, 5:39 PM >> Dale Johannesen schrieb: >>> On Sep 17, 2008, at 2:36 PMPDT, Michael Reichenbach >> wrote: >>>> No matter if I try " >>>> llvm-g++ a.cpp -c -emit-llvm >>>> " with "LLVM-GCC 4.2 Front End Binaries >> for Mingw32/x86" on Windows XP >>>> or if I am trying it on Ubuntu... >>>> >>>> Only the a.o file will be created without any >> error messages. The .bc >>>> file will not be created, do you know why? >>> -emit-llvm doesn't change the default name for the >> -c output. >>> The .o file should be llvm binary IR; if you want it >> named .bc, use -o >>> a.bc >>> If you're starting out, probably -S -emit-llvm is >> more useful, you can >>> read that format. >> Ok, I understand so far. >> >> I have a partially working example now. >> >> llvm-g++ a.cpp -c -emit-llvm >> llvm-g++ b.cpp -c -emit-llvm >> llvm-link a.o b.o -o program.bc >> llc -march=c program.bc -o program.c >> gcc program.c >> >> program.c will contain some non-human generated code. But >> it doesn't >> compile with gcc. There is an error, gcc complaints about >> undefined >> reference to std::cout and such (the code was just a very >> small example >> with cout). >> >> It hasn't be converted into "C only" code, >> can you tell me why? >> >> Regards, >> -mr
Eli Friedman schrieb:> On Wed, Sep 17, 2008 at 3:39 PM, Michael Reichenbach > <michael_reichenbach at freenet.de> wrote: >> program.c will contain some non-human generated code. But it doesn't >> compile with gcc. There is an error, gcc complaints about undefined >> reference to std::cout and such (the code was just a very small example >> with cout). >> >> It hasn't be converted into "C only" code, can you tell me why? > > If your code uses the C++ library, you'll need to link it against a > C++ library. That has nothing to do with the language of the code. > > -EliI was only using the C++ standard lib. It doesn't need to be linked because it's only a header. Better said, it can't be linked with the std lib, never heard that it's needed to link it. Btw the code compiles and runs for sure with a g++ and also with llvm-g++. Only the converted C output contains still references to C++. How can I remove them? -mr