Hi Duncan, Thanks for the reply, that did indeed work. I realise that I could use llvm-gcc but I want to learn how to use the parts of llvm that would allow me to make my own compiler (eventually), also at this point I'm trying to avoid having to build all of llvm myself and just use what is available pre-built from the site. I was wondering how to actually create the exe? For example with gcc: gcc hello.c -S -o hello_gcc.s produces a native assembly file and then gcc hello_gcc.s -o hello_gcc_asm.exe will produce the final "hello world" I can run. With llvm, I've done: hello.c to hello.ll via the online LLVM compiler tool (http://llvm.org/demo/index.cgi) then llvm-as hello.ll to create the hello.bc, then llc hello.bc to create the hello.s but if I try and create an exe from this assembly file with gcc I get a number of errors, Likewise, "cl.exe" (microsoft compiler) says "cl : Command line warning D9024 : unrecognized source file type 'hello.s', object file assumed" PS: Including a link to this: "http://llvm.org/cmds/" in the mingw distribution would probably help other people get up and running quicker.
On Sat, May 30, 2009 at 2:38 AM, Adrian Boeing<aboeing at gmail.com> wrote:> With llvm, I've done: > hello.c to hello.ll via the online LLVM compiler tool > (http://llvm.org/demo/index.cgi) > then > llvm-as hello.ll > to create the hello.bc, then > llc hello.bc > to create the hello.sTry changing the third line of the output from the demo to look like the following: target triple = "i586-mingw32msvc" The online demo output explicitly requests an x86 Linux target, so llc honors that rather than generating code for your native platform. If you change the target triple to a Windows target triple, gcc should do the right thing with the output. -Eli
On Sat, May 30, 2009 at 2:38 AM, Adrian Boeing<aboeing at gmail.com> wrote:> I realise that I could use llvm-gcc but I want to learn how to use the > parts of llvm that would allow me to make my own compiler > (eventually), also at this point I'm trying to avoid having to build > all of llvm myself and just use what is available pre-built from the > site.There's a pre-built llvm-gcc for Windows at http://llvm.org/releases/download.html (LLVM-GCC 4.2 Front End Binaries for Mingw32/x86"). It's a separate download from the rest of the LLVM binaries. -Eli
Hi Eli,> Try changing the third line of the output from the demo to look like > the following: > target triple = "i586-mingw32msvc"Fantastic, thanks!>There's a pre-built llvm-gcc for Windows atHmm, don't know how I missed that... I guess that clears up all my beginners issues. Thanks, -Adrian