[LLVMdev] Compiling zlib to static bytecode archive

Chris Lattner sabre at nondot.org
Fri Sep 21 11:01:28 PDT 2007


On Sep 21, 2007, at 9:42 AM, Maarten ter Huurne wrote:

> However, it is not possible to let the zlib Makefile issue that  
> command
> without patching the Makefile, because the fragment that does the  
> linking is
> hardcoded to use the compiler command for linking:
>
>   example$(EXE): example.o $(LIBS)
>           $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS)

Right, unfortunately the current Link Time Optimization model  
requires the linker to "know" about LLVM.
http://llvm.org/docs/LinkTimeOptimization.html


> Would it be possible to make llvm-gcc call llvm-ld instead of the  
> systemwide
> ld? I tried setting the environment variables COMPILER_PATH=/usr/ 
> local/bin
> and GCC_EXEC_PREFIX=llvm- but that had no effect.

I see two solutions to this.  One is to have llvm-gcc call llvm-ld  
when it has some option passed to it.  Another would be to enhance  
'collect2' to know about LLVM files.  'collect2' is a GCC utility  
invoked at link time, it would be the perfect place to add hooks.

The thing we're missing most right now is a volunteer to tackle this  
project :)

-Chris



More information about the llvm-dev mailing list