Question on link error

So I’ve built llvm-2.2 using Cygwin, and I think I’ve got all the right bits in the right places, but I’m getting a strange error when running through the hello.c examples from the Web site:

Ted@XPLanguages /cygdrive/c/Projects/Exploration/llvm

$ gcc hello.s -o hello.native

Ted@XPLanguages /cygdrive/c/Projects/Exploration/llvm

$ ls

hello.bc hello.c* hello.exe* hello.native* hello.s

Ted@XPLanguages /cygdrive/c/Projects/Exploration/llvm

$ ./hello.native

hello world

Ted@XPLanguages /cygdrive/c/Projects/Exploration/llvm

$ lli hello.bc

ERROR: Program used external function ‘__main’ which could not be resolved!

Aborted

Is there something Really Really Simple ™ that I’m missing here? AFAIK, __main is supposed to be inside hello.bc, so why can’t lli find it?

Ted Neward

Java, .NET, XML Services

Consulting, Teaching, Speaking, Writing

http://www.tedneward.com

No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.516 / Virus Database: 269.20.5/1278 - Release Date: 2/14/2008 10:28 AM

So I’ve built llvm-2.2 using Cygwin, and I think I’ve got all the right bits in the right places, but I’m getting a strange error when running through the hello.c examples from the Web site:

How did you create hello.s? What version of llvm-gcc are you using? 4.2? Have you tried compiling hello.s to hello.native with llvm-gcc instead of gcc?

-Chris

(*) hello.s was created as per what’s on the LLVM page:

Ted@XPLanguages /cygdrive/c/Projects/Exploration/llvm

$ llc hello.bc -o hello.s

(*) gcc is llvm-gcc, compiled from the llvm-gcc-4.2 source tree:

Ted@XPLanguages /cygdrive/c/Projects/Exploration/llvm

$ gcc --version

gcc (GCC) 4.2.1 (Based on Apple Inc. build 5546) (LLVM build)

Copyright (C) 2007 Free Software Foundation, Inc.

This is free software; see the source for copying conditions. There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

(*) Yes, I compiled hello.s → hello.native using llvm-gcc, since that’s what’s on the PATH ahead of the original Cygwin gcc. Hello.native also runs just fine.

Ted Neward

Java, .NET, XML Services

Consulting, Teaching, Speaking, Writing

http://www.tedneward.com