[LLVMdev] llvm-ld error

Reid Spencer rspencer at reidspencer.com
Wed Mar 7 11:29:19 PST 2007


Ryan,

On Wed, 2007-03-07 at 06:26 -0600, Ryan M. Lefever wrote:
> I was able to correct this problem by checking out the latest version of 
> llvm-gcc4 from svn and compiling it from source.  One note, in order to 
> get llvm-gcc4 to compile, I had to add
> 
> #include "llvm/Analysis/LoopPass.h"
> 
> to gcc/llvm-backend.cpp
> 
> Ryan M. Lefever wrote:
> > I get a similar error when I try to disassemble a bytecode file 
> > generated by llvm-gcc released for llvm 1.9.  Do I need to upgrade to a 
> > new llvm-gcc?

I'm glad you figured this out on your own, however there's a copule
things you should know. 

The bytecode and assembly formats have changed radically between 1.9 and
2.0. The 2.0 format has settled down now (it was tumultuous in the last
few months) and we have removed backwards compatibility from the asm
parser and the bc reader. This was necessitated because the changes were
so significant that the backwards compat code was really hard to
maintain. Instead, we have a new tool, llvm-upgrade which provides
upgrading llvm assembly from versions as far back as 1.5 to 2.0 format. 

The way to upgrade a bytecode file is to disassemble it with the old
llvm-dis, upgrade the resulting assembly with the new llvm-upgrade tool,
then assemble it with the new llvm-as. Something like:

llvm-1.9/bin/llvm-dis my1.9.bc -o - | llvm-upgrade |
llvm-2.0/bin/llvm-as -o my2.0.bc

Reid.

> > 
> > Ryan M. Lefever wrote:
> >> I am trying to use llvm-ld but when I try to link several bytecode files 
> >> into a single bytecode file, it gives me the following error:
> >>
> >> llvm-ld -o benchmarks/bc-1.06/src/bc.c.bc benchmarks/bc-1.06/src/bc.i.bc 
> >> benchmarks/bc-1.06/src/execute.i.bc benchmarks/bc-1.06/src/getopt1.i.bc 
> >> benchmarks/bc-1.06/src/getopt.i.bc benchmarks/bc-1.06/src/global.i.bc 
> >> benchmarks/bc-1.06/src/load.i.bc benchmarks/bc-1.06/src/main.i.bc 
> >> benchmarks/bc-1.06/src/number.i.bc benchmarks/bc-1.06/src/scan.i.bc 
> >> benchmarks/bc-1.06/src/storage.i.bc benchmarks/bc-1.06/src/util.i.bc 
> >> benchmarks/bc-1.06/src/vfprintf.i.bc -link-as-library
> >> llvm-ld: error: Cannot load file 
> >> 'benchmarks/bc-1.06/src/bc.i.bc'Bytecode file 
> >> 'benchmarks/bc-1.06/src/bc.i.bc' could not be loaded: Don't know how to 
> >> deserialize primitive type 16 (Vers=0, Pos=15)
> >>
> >> I am using llvm-ld built from the cvs checked out yesterday.  llvm-gcc 
> >> was used to build the bytecode files passed as input to llvm-ld, and its 
> >> version is:
> >>
> >> llvm-gcc (GCC) 4.0.1 LLVM (Apple Computer, Inc. build 5421)
> >>
> >> Does anyone know what the problem is?
> >>
> >> Thanks,
> >> Ryan
> >> _______________________________________________
> >> LLVM Developers mailing list
> >> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> > 
> 




More information about the llvm-dev mailing list