Hello,
I'm considering LLVM for a project, and I wanted to take a look at its
bytecode representation/instruction set. So I decided to try to compile
the /bin/ls command as bytecode (no particular reason to use ls) and
look at it. So I got GNU coreutils from
http://ftp.gnu.org/gnu/coreutils/coreutils-5.0.tar.gz, built it to make
sure it works, then replaced gcc, ld, ar and ranlib with the LLVM
versions in the Makefile and built it again.
Initially I did this with llvm-1.9, but I later tested it with llvm-2.0
to make sure this wasn't a problem that got fixed in a later release. I
had problems with both versions, albeit slightly different ones. In
both version the linking with the libfetish.a (part of the coreutils
package) fails. With llvm-1.9, the library builds, and when I run these
commands, they give the following results:
Llvm-bcanalyzer: version number as 155730296, both file and module size
as 267206, and the rest of the stuff is all 0s, 0% or NAN (not-a-number)
Llvm-dis: Invalid bytecode signature: 72613C21 (Vers=0, Pos=4)
Llvm-ar t: lists all the object files in the library
Llvm-nm: libfetish.a: Success
Llvm-ranlib: nothing (shell prompt just comes back).
Llvm-link: Invalid bytecode signature: 72613C21 (Vers=0, Pos=4)
These are the commands used to compile the library source files (acl.c
ist just one example):
llvm-gcc -DLIBDIR=\"/usr/local/lib\" -DHAVE_CONFIG_H -I. -I. -I.. -I..
-I. -g -O2 -emit-llvm -c -o acl.o acl.c
Command to create the library (omitted all the other .o files):
llvm-ar cru libfetish.a acl.o ...
llvm-ranlib libfetish.a
Command to build and link executable:
llvm-gcc -DLOCALEDIR=\"/usr/local/share/locale\"
-DSHAREDIR=\"/usr/local/share\" -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.
-I../lib -I../lib -g -O2 -emit-llvm -c -o chrgrp.o chgrp.c
llvm-gcc -DLOCALEDIR=\"/usr/local/share/locale\"
-DSHAREDIR=\"/usr/local/share\" -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.
-I../lib -I../lib -g -O2 -emit-llvm -c -o chown-core.o chown-core.c
llvm-link -v -o chgrp chgrp.o chown-core.o ../lib/libfetish.a
../lib/libfetish.a
I added the -v option after it failed. Here's the whole output from
llvm-link:
Loading 'chgrp.o'
Locading 'chown-core.o'
Linking on 'chown-core.o'
Loading '..\lib\libfetish.a'
Error opening bytecode file '../lib/libfetish.a': Invalid bytecode
signature: 72613C21 (Vers=0, Pos=4)
llvm-link:error loading file '../lib/libfetish.a'
I repeated the same thing with llvm-2.0. The commands are the same, but
the output differs:
Llvm-bcanalyzer: Bitcode stream should be a multiple of 4 bytes in
length
Llvm-dis: Bitcode stream should be a multiple of 4 bytes in length
Llvm-ar t: list of .o files
Llvm-nm: list of .o files and their symbols
Llvm-ranlib: nothing (shell prompt just comes back)
llvm-link: Bitcode stream should be a multiple of 4 bytes in length
Llvm-link output is the same as llvm-1.9, except the error message.
All this runs on Fedora Core 7 in VMWare hosted on a WindowsXPSP2
machine.
Any ideas? It seems that having problems linking in libraries is a very
fundamental problem and must have been addressed. However, a web
search, documentation and FAQ didn't produce anything, and the mailing
is not searchable (that I am aware of).
Thanks
-aram
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20070927/53de9a8f/attachment.html>