Hello,<div><br></div><div>I have been trying to compile a few small programs [<a href="http://www.esm.psu.edu/~ajm138/fortranexamples.html">http://www.esm.psu.edu/~ajm138/fortranexamples.html</a>] 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:</div>
<meta http-equiv="content-type" content="text/html; charset=utf-8"><div><br></div><div>$ llvm-gfortran -c sample.f -emit-llvm -o sample.o</div><div><br></div><div>$ lli sample.o</div><div>'main' function not found in module</div>
<div><br></div><div>$ llvm-dis < sample.o | grep main | wc -l</div><div>0</div><div><br></div><div>$ llvm-dis < sample.o | grep MAIN | wc -l</div><div>1</div><div><br></div><div>$ llvm-ld -native sample.o -L ~/apps/llvm-gcc/lib64/ -lgfortran</div>
<div><div>/usr/lib/../lib64/crt1.o: In function `_start':</div><div>(.text+0x21): undefined reference to `main'</div><div>collect2: ld returned 1 exit status</div><div>llvm-ld: </div></div><div><br></div><div>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?</div>
<div><br></div><div>Thanks,</div><div>Ashay</div><div><br></div><meta http-equiv="content-type" content="text/html; charset=utf-8">