Help with libLTO and clang

Hi all,

I am testing link time optimizations with clang on linux x86_64
machine running Ubuntu Maverick.
I am using clang with llvm release-3.0

I followed the instructions on http://llvm.org/docs/LinkTimeOptimization.html

However, when I try to compile with one file being bitcode and other
being native code exactly as shown in the documentation, I get the
following errors

clang a.o main.o -o main.out

gives

/usr/bin/ld: error: a.o:1:3: invalid character
/usr/bin/ld: error: a.o:1:3: syntax error, unexpected $end
/usr/bin/ld: error: a.o: not an object or archive
/usr/bin/ld: main.o: in function main:main.c(.text+0x30): error:
undefined reference to 'foo1'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I have the GOLD linker installed in the system.

/usr/bin/ld --version

displays

GNU gold (GNU Binutils for Ubuntu 2.21.0.20110327) 1.11

Any suggestions?

Santosh

clang a.o main.o -o main.out

...

Any suggestions?

Try adding -use-gold-plugin.

Santosh

Cheers,
Rafael

Hi all,

I am testing link time optimizations with clang on linux x86_64
machine running Ubuntu Maverick.
I am using clang with llvm release-3.0

I followed the instructions on http://llvm.org/docs/LinkTimeOptimization.html

However, when I try to compile with one file being bitcode and other
being native code exactly as shown in the documentation, I get the
following errors

clang a.o main.o -o main.out

Try adding the -use-gold-plugin command-line option to the clang compile and link lines.

-- John T.