[LLVMdev] llvm-gfortran gives errors on AMD64-Ubuntu

Duncan Sands duncan.sands at math.u-psud.fr
Mon Nov 3 00:51:54 PST 2008


> I have installed llvm and llvm-gfortran on Pentium4 machine using 32-bit
> Ubuntu, it works fine. I recently installed them on AMD64-Ubuntu 8.04,
> llvm-gfortran gave me following errors 
> $ llvm-gfortran -Wall hello.f95 -o hellof

this works here on x86-64 ubuntu 8.10.  I took a look in my libgfortran.a
and it doesn't reference any of the symbols you mention.

> /home/jli127/LLVM/llvm-gcc/install/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.2.1/../../../../lib64/libgfortran.a(error.o):
> In function `_gfortrani_gfc_itoa':
> (.text+0x76): undefined reference to `__umoddi3'

This is a library function for doing 64 bit unsigned rem.
On a 64 bit machine you shouldn't need to call a library
function for this!  Are you sure you didn't mix up 64 bit
and 32 bit somewhere?

> (2) Can I get LLVM bitcode file and run it as llvm-gcc does? 
> It give following errors on both 32bit and 64bit Ubuntu.
> $ llvm-gfortran -O3 -emit-llvm hello.f95 -c -o hellof.bc
> $ lli hellof.bc
> 	ERROR : 'main' function not found in module.	

The reason for this is that Fortran outputs the entry point
into your program as MAIN__ not main.  Instead "main" is
defined in libgfortranbegin; it does some initialization
(exception handling, command line arguments, others?) then
calls MAIN__.  I don't know much about lli, so hopefully
someone else can explain how to handle this situation.

> $ llc hellof.bc -o hellof.s
> $ gcc hellof.s -o hellof.native
> /usr/lib/gcc/i486-linux-gnu/4.1.3/../../../../lib/crt1.o: In function
> `_start':
> (.text+0x18): undefined reference to `main'

You need to link with -lgfortranbegin.

> (3) Where can I get the SPEC/polyhedron testsuites?

I don't know, sorry.

Best wishes,


More information about the llvm-dev mailing list