[cfe-dev] LTO on FreeBSD

David Chisnall theraven at sucs.org
Wed Jun 30 08:09:45 PDT 2010


On 30 Jun 2010, at 15:58, SKL wrote:

>>> 
>>> What about llvm-ld? Should it not be useable as a linker on FreeBSD?
>> 
>> llvm-ld is half-baked at best, it doesn't know a lot of options that your system linker does.  It may work for simple things, but probably not for largish real world programs.
> 
> Ah, I had been curious about this as well. Is the long-term goal for llvm-ld to be a full drop-in replacement for the system linker?

I don't think anyone is working on llvm-ld anymore.  This was the original goal, but it turns out that every system has a different set of linker options so it's not worth the effort.  It might be worth FreeBSD forking llvm-ld and producing a version that can drive FreeBSD's ld and implements all of the options that this linker implements, but probably not.

> So, my original assumption that the OS X clang is using ld with the gold plugins was correct?

Nope.  OS X clang uses the Darwin linker, which has native LLVM support via libLTO.dylib

> If so, I'm curious where it's hidden away. I see a lot of libLLVMContainer.dylib files under the /Developer tree, but no files relating to "gold" anywhere. 

As espected.

> It sounds like my only option on the FreeBSD side is to try and compile the llvm gold plugins. I've pulled down the cvs source and will try my hand at compiling it. Has anyone had any luck with compiling this package under FreeBSD or will I have to resign myself to a lot of hand-tweaking?

I don't know if gold supports FreeBSD.  Last time I tried it, it compiled fine, but the result of using it was a load of nonsense (even without the plugin).  

> As there's some talk of migrating over to clang in the long-term, I'd be interested to see if/how the FreeBSD folks are planning to implement LTO without using any GNU code.

There are plans as part of the elftoolchain project to write a BSD-licensed linker, which will probably eventually replace GNU ld in FreeBSD.  I'd imagine that, like the Darwin linker, this will end up with native support for LTO via LLVM.

David



More information about the cfe-dev mailing list