Bug#718000: llvm-dev: LLVM gold plugin has failed to create LTO module: Invalid bitcode signature

duerspm at online.de duerspm at online.de
Sat Jul 27 19:02:02 UTC 2013

Package: llvm-dev
Version: 1:3.2-19
Severity: important
Tags: upstream

Dear Maintainer,

   * What led up to the situation?
Compiling a simple hello world program written in C works fine with clang
compiler unless
any of the options -O4 or -emit-llvm is specified.

clang -O4 hello.c -o hello
clang -emit-llvm hello.c -o hello

For this, Also ld has to be symlinked to the gold linker (/usr/bin/ld.gold) as the
ld.bfd linker DOES NOT support
the -plugin argument, which clang passes to the linker!

   * What was the outcome of this action?

me at debian:/tmp$ clang -v -O4 hello.c
Debian clang version 3.2-10 (tags/RELEASE_32/final) (based on LLVM 3.2)
Target: i386-pc-linux-gnu
Thread model: posix
 "/usr/bin/clang" -cc1 -triple i386-pc-linux-gnu -emit-llvm-bc -disable-free
-disable-llvm-verifier -main-file-name hello.c -mrelocation-model static
-fmath-errno -masm-verbose -mconstructor-aliases -fuse-init-array -target-cpu
pentium4 -target-linker-version -momit-leaf-frame-pointer -v
-resource-dir /usr/bin/../lib/clang/3.2 -fmodule-cache-path /var/tmp/clang-
module-cache -internal-isystem /usr/local/include -internal-isystem
/usr/bin/../lib/clang/3.2/include -internal-isystem
/usr/include/clang/3.2/include/ -internal-externc-isystem /usr/include/i386
-linux-gnu -internal-externc-isystem /usr/include/i486-linux-gnu -internal-
externc-isystem /usr/include -O3 -fdebug-compilation-dir /tmp -ferror-limit 19
-fmessage-length 125 -mstackrealign -fobjc-runtime=gcc -fdiagnostics-show-
option -fcolor-diagnostics -o /tmp/hello-KdAKtA.o -x c hello.c
clang -cc1 version 3.2 based upon LLVM 3.2svn default target i386-pc-linux-gnu
ignoring nonexistent directory "/usr/bin/../lib/clang/3.2/include"
ignoring nonexistent directory "/usr/include/i486-linux-gnu"
#include "..." search starts here:
#include <...> search starts here:
End of search list.
 "/usr/bin/ld" --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o
a.out /usr/bin/../lib/gcc/i486-linux-gnu/4.8/../../../i386-linux-gnu/crt1.o
/usr/bin/../lib/gcc/i486-linux-gnu/4.8/crtbegin.o -L/usr/bin/../lib/gcc/i486
-linux-gnu/4.8 -L/usr/bin/../lib/gcc/i486-linux-gnu/4.8/../../../i386-linux-gnu
-L/lib/i386-linux-gnu -L/usr/lib/i386-linux-gnu -L/usr/bin/../lib/gcc/i486
-linux-gnu/4.8/../../.. -L/lib -L/usr/lib -plugin /usr/bin/../lib/LLVMgold.so
/tmp/hello-KdAKtA.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-
needed -lgcc_s --no-as-needed /usr/bin/../lib/gcc/i486-linux-gnu/4.8/crtend.o
/usr/bin/ld: error: LLVM gold plugin has failed to create LTO module: Invalid
bitcode signature
/usr/bin/ld: error: /tmp/hello-KdAKtA.o:1:3: invalid character
/usr/bin/ld: error: /tmp/hello-KdAKtA.o:1:3: syntax error, unexpected $end
/usr/bin/ld: error: /tmp/hello-KdAKtA.o: not an object or archive
gnu/crt1.o(.text+0x18): error: undefined reference to 'main'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
me at debian:/tmp$ ld -v
GNU gold (GNU Binutils for Debian 1.11

   * What outcome did you expect instead?
Links without error

-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 3.9-1-686-pae (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages llvm-dev depends on:
ii  llvm          1:3.2-19
ii  llvm-3.2-dev  1:3.2repack-10
ii  llvm-runtime  1:3.2-19
ii  clang  1:3.2-19

llvm-dev recommends no packages.

llvm-dev suggests no packages.

More information about the Pkg-llvm-team mailing list