[LLVMdev] LLVM compile with -emit-llvm

Devang Patel dpatel at apple.com
Thu Feb 26 12:53:50 PST 2009


On Feb 26, 2009, at 12:40 PM, Brice Lin wrote:

> Sorry, I should have been clearer. My question deals with -emit-llvm
> and -c, not -g and debug information. If you remove the -g flag from
> the command I posted previously, the problem remains. Either way, I
> updated my tree recently.
>
> Oddly enough, -emit-llvm affects the compile for me without -c or -S.
> When I run the aforementioned command, llvm-gcc outputs the following:
>
> ld warning: in /var/tmp//cc7JazVe.o, file is not of required  
> architecture
> Undefined symbols:
>  "_main", referenced from:
>      start in crt1.10.5.o
> ld: symbol(s) not found
> collect2: ld returned 1 exit status


>> On Feb 26, 2009, at 10:16 AMPST, Brice Lin wrote:
>>
>>> Is it possible to add any flags to this command so that the  
>>> resulting
>>> compile runs perfectly fine (-c builds, but does not work)?

You want to remove -emit-llvm from the command line. What is the  
motivation to add -emit-llvm on the command line ?

Here, -emit-llvm instructs llvm-gcc (even without -c or -S) to keep  
llvm IR in the generated .o file. The linker is expected to handle  
incoming .o file that contains LLVM IR. This is part of Link Time  
Optimization feature.

-
Devang



More information about the llvm-dev mailing list