questions about gold plugin

I am a bit confused by the documentation of the gold plugin (http://llvm.org/docs/GoldPlugin.html). I want to use the gold plugin on my Linux system so I can run "llvm-gcc -use-gold-plugin." In the documentation it talks about building gold with plugin support (which involves running "make gold-all") and building the LLVMgold plugin (which involves configuring LLVM with the --with-binutils-include option). Do I need to do both?

I am trying to build the gold plugin for LLVM 2.6. Is there a particular version of the gold plugin I should get? The instructions in the documentation do not mention anything about different versions of the gold plugin.

Thanks,
Ryan

Hi Ryan,

I am a bit confused by the documentation of the gold plugin
(http://llvm.org/docs/GoldPlugin.html). I want to use the gold plugin
on my Linux system so I can run "llvm-gcc -use-gold-plugin." In the
documentation it talks about building gold with plugin support (which
involves running "make gold-all") and building the LLVMgold plugin
(which involves configuring LLVM with the --with-binutils-include
option). Do I need to do both?

yes. To do link-time optimization using LLVM, the linker (= gold) needs to be
able to recognize LLVM bitcode and perform LLVM optimizations on it. Likewise,
to do link-time optimization using gcc, the linker needs to be able to recognize
GCC gimple and perform GCC optimizations on it. The linker is taught about LLVM
bitcode / GCC gimple by loading a plugin, the plugin being provided by the LLVM
project (LLVMgold plugin) or by the GCC project.

If you don't enable plugin support in gold in you won't be able to load any
plugins whatsoever into gold. However enabling plugin support in gold doesn't
mean you actually get any plugins - gold doesn't come with any. The idea is
that external projects (like LLVM) should provide plugins that enhance gold with
capabilities related to that project (like recognizing LLVM bitcode).

So once you have built gold with plugin support enabled, you still need to build
the LLVM / GCC / whatever plugin. In the case of LLVM, this means configuring
with --with-binutils-include.

I am trying to build the gold plugin for LLVM 2.6. Is there a particular
version of the gold plugin I should get? The instructions in the
documentation do not mention anything about different versions of the
gold plugin.

Yes, you need to use the right version of gold. I don't know what version that
is.

Ciao,

Duncan.