[LLVMdev] Replace gcc with llvm-gcc

zhunan zhunansjtu at gmail.com
Mon Sep 14 23:35:19 PDT 2009


I truly get the bytecode file for each souce file,but can I use
llvm-link to link them into a whole-program one automatically through
some scripts?


> 
> Message: 27
> Date: Tue, 15 Sep 2009 03:16:10 +0200
> From: ?scar Fuentes <ofv at wanadoo.es>
> Subject: Re: [LLVMdev] Replace gcc with llvm-gcc???
> To: llvmdev at cs.uiuc.edu
> Message-ID: <87vdjlnh2d.fsf at telefonica.net>
> Content-Type: text/plain; charset=windows-1252
> 
> zhunan <zhunansjtu at gmail.com> writes:
> 
> > Recently I met a question when I want to replace gcc with llvm-gcc
> > through configure script(command).
> >
> > For simply,described like that
> >
> > I typed as following
> >
> > 1.zhunan at sjtu:~/workplace/$ ./configure CC=llvm-gcc CFLAGS="-S
> > -emit-llvm"
> >
> > configure will failed when it checks whether C compiler is working
> >
> > 2.zhunan at sjtu:~/workplace/$ ./configure CC=llvm-gcc CFLAGS="-c
> > -emit-llvm"
> >
> > configure will failed when it checks the default output filename,just
> > means the C compiler cannot create executables.
> >
> >
> > I would like to know what's the matter with this replacing attempt?and
> > any possibility to overcome the trouble?
> 
> Your CFLAGS is telling llvm-gcc that it must not produce an object code
> file nor an executable file, but something else (llvm assembler on your
> first attempt and llvm bitcode on your second attempt).
> 
> `configure' needs a fully working compiler toolset, which means that the
> compiler must be able to produce executable files. Your CFLAGS setting
> is preventing this.
> 
> Execute `configure' with just CC=llvm-gcc and then try
> 
> make CFLAGS="-emit-llvm"
> 
> if you want LLVM bitcode or
> 
> make CFLAGS="-S -emit-llvm"
> 
> if you want LLVM assembler.
> 
> `make' will fail at the linking phase, but you will have a set of LLVM
> bitcode/assembler files for each of your C source files.
> 
> If you simply want to replace gcc with llvm-gcc for building your
> software, forget about CFLAGS and just do
> 
> ./configure CC=llvm-gcc && make
> 




More information about the llvm-dev mailing list