[LLVMdev] LLVM compile with -emit-llvm

Brice Lin brice.lin at gmail.com
Thu Feb 26 13:23:58 PST 2009


To put my problem into perspective, I want to run LLVM passes on the
bitcode that results from compiling the portable version of OpenSSH
(hence the need for -emit-llvm). Right now, I run ./configure and
manually modify the Makefile to include -emit-llvm in the CFLAGS. This
suffices as a workaround for now.

However, I would like not to modify the Makefile. When I run
./configure, I can pass additional CFLAGS I would like to use in the
compilation step (-emit-llvm in my case). However, Autoconf (at least
in this particular ./configure script) runs the command from my
original post as a test, which fails because llvm-gcc dies on the
compile. In essence, the Autoconf test requires an executable, but I
want to output bitcode when I compile OpenSSH; it seems like I must
continue to use the workaround. I hope that describes my situation
clearly.

On Thu, Feb 26, 2009 at 2:53 PM, Devang Patel <dpatel at apple.com> wrote:
>
> 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
> _______________________________________________
> 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