[LLVMdev] llvm-gfortran problems

Ashay Rane ashay.rane at tacc.utexas.edu
Wed Aug 31 13:48:06 PDT 2011


Hello,

I have been trying to compile a few small programs [
http://www.esm.psu.edu/~ajm138/fortranexamples.html] using llvm-gfortran.
Since I run my own pass on the generated bitcode, I have had to split the
compilation process into using llvm-gfortran, opt and then llvm-ld (for
linking, as I do with C/C++ programs). For now, I'll drop the `opt'
statement. Here's what I see while compiling:

$ llvm-gfortran -c sample.f -emit-llvm -o sample.o

$ lli sample.o
'main' function not found in module

$ llvm-dis < sample.o | grep main | wc -l
0

$ llvm-dis < sample.o | grep MAIN | wc -l
1

$ llvm-ld -native sample.o -L ~/apps/llvm-gcc/lib64/ -lgfortran
/usr/lib/../lib64/crt1.o: In function `_start':
(.text+0x21): undefined reference to `main'
collect2: ld returned 1 exit status
llvm-ld:

I am not very familiar with Fortran programs. I saw a few programs that had
a "MAIN" subroutine defined, some others that did not. Am I missing
something while compiling the code? Is there a different way to compile
bitcode (from Fortran programs) to a native binary?

Thanks,
Ashay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110831/13dc93ea/attachment.html>


More information about the llvm-dev mailing list