[LLVMdev] LLVM compile with -emit-llvm

Brice Lin brice.lin at gmail.com
Thu Feb 26 12:40:25 PST 2009


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 Thu, Feb 26, 2009 at 12:39 PM, Dale Johannesen <dalej at apple.com> wrote:
>
> 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)?
>>
>> llvm-gcc -o conftest -g -O2 -Wall -Wpointer-arith -Wuninitialized
>> -Wsign-compare -Wno-pointer-sign -Wformat-security -fno-builtin-memset
>> -emit-llvm <filename.c>
>>
>> where <filename.c> contains
>>
>> #include <stdio.h>
>>
>> int main() {
>>       exit(0);
>> }
>
> The line you have works fine for me.  There have been a lot of changes
> related to debug info recently so make sure you are up to date.
> Beyond that we'd need information about your environment to help.
>
> Note that -emit-llvm asks for LLVM intermediate representation as
> output; but it has no effect without -c  or -S.  Combined with -c it
> produces binary format LLVM IR; you should not expect this to be
> executable.
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>




More information about the llvm-dev mailing list