[LLVMdev] llvm-gcc with static libraries

Ashay Rane ashay.rane at tacc.utexas.edu
Tue Aug 9 14:08:12 PDT 2011


Hi,

Thanks for the pointers. I built binutils and installed them in the same
place as llvm-gcc. However, I see the following error at the link step:
$ llvm-gcc prog.c libctest.a
collect2: ld terminated with signal 6 [Aborted]
/tmp/llvm-gcc4.2-2.9-x86_64-linux/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.2.1/../../../../x86_64-unknown-linux-gnu/bin/ld:
error: libctest.a: malformed archive header name at 8
terminate called after throwing an instance of 'std::length_error'
  what():  basic_string::assign

I have copied over ld.gold to ld:
$ diff ld.gold ld
$

If I use -use-gold-plugin, llvm-gcc says:
llvm-gcc: -use-gold-plugin, but LLVMgold.so not found.

I created the following shell script (called it `ld') and placed it into the
same directory as llvm-gcc:
$ cat ld
#!/bin/sh

/tmp/llvm-gcc4.2-2.9-x86_64-linux/bin/ld.gold -plugin
${HOME}/apps/llvm/LLVMgold.so $*
$

But the output from llvm-gcc does not change. Any clue whats wrong?

There is no /usr/lib/bfd-plugins nor is there a lib/bfd-plugins in the
location where the new binutils was installed. Where is this file supposed
to be copied?

Ashay


On Tue, Aug 9, 2011 at 2:12 PM, Eli Friedman <eli.friedman at gmail.com> wrote:

> On Tue, Aug 9, 2011 at 12:03 PM, Ashay Rane <ashay.rane at asu.edu> wrote:
> > `/usr/bin/ld -v' says it is not running gold and I suppose fixing that
> would
> > require place LLVMgold.so into /usr/lib/bfd-plugins. Is there any way to
> > make this work without requiring root access to the machine?
>
> If you install your own version of binutils into the same prefix as
> llvm-gcc,
> it should get used instead of the one in /usr/bin/.
>
> > Also, just to confirm, is the gold plugin required even when all of the
> > files have been compiled/built using llvm-gcc and llvm-ar?
>
> You can try llvm-ld... it isn't a fully general linker, but it might
> be good enough for your purposes.
>
> -Eli
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110809/a4f3a872/attachment.html>


More information about the llvm-dev mailing list