Hello,<div><br></div><div>Sorry for the late reply. Using dragonegg worked well, thanks all!</div><div><br></div><div>Just as a note... I had to use llvm-ld during the link step because gfortran could not link bitcode. Here's an example of the error shown when using gfortran instead of llvm-ld:</div>
<div><br></div><div>$ <meta http-equiv="content-type" content="text/html; charset=utf-8">${GCC_4_5_0}/bin/gfortran hw.f -c -fplugin=<meta http-equiv="content-type" content="text/html; charset=utf-8">${DRAGONEGG_PLUGIN}/dragonegg.so -o hw.o -flto -emit-llvm -S</div>
<div>$ ${LLVM_2_9}/bin/opt -mem2reg hw.o -o hw.o</div><div>$ ${GCC_4_5_0}/bin/gfortran -fplugin=${DRAGONEGG_PLUGIN}/dragonegg.so ${GCC_4_5_0}/lib64/libgfortran.a hw.o -o hw</div><div><div>hw.o: file not recognized: File format not recognized</div>
<div>collect2: ld returned 1 exit status</div></div><div><br></div><div>$ file hw.o</div><div>hw.o: data</div><div><br></div><div>Instead, using llvm-ld:</div><div>$ ${LLVM_2_9}/bin/llvm-ld -native hw.o -o hw ${GCC_4_5_0}/lib64/libgfortran.a -lm</div>
<div><br></div><div>llvm-gcc had the gold plugin. I wonder if there is any equivalent of that for dragonegg to be able to compile bitcode and native object code in a transparent manner.</div><div><br></div><div>Thanks again!</div>
<div>Ashay</div><div><br></div><div><br><div class="gmail_quote">On Wed, Aug 31, 2011 at 4:29 PM, Anton Korobeynikov <span dir="ltr"><<a href="mailto:anton@korobeynikov.info" target="_blank">anton@korobeynikov.info</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello<br>
<div><br>
> I am not very familiar with Fortran programs. I saw a few programs that had<br>
> a "MAIN" subroutine defined, some others that did not. Am I missing<br>
> something while compiling the code? Is there a different way to compile<br>
> bitcode (from Fortran programs) to a native binary?<br>
</div>For Fortran MAIN is indeed something similar to C main, but not<br>
exactly the same.<br>
You have to link the runtime library (libgfortran.a) in order to get<br>
"proper" main, mak sure all stuff is initialized properly, etc.<br>
<font color="#888888"><br>
--<br>
With best regards, Anton Korobeynikov<br>
Faculty of Mathematics and Mechanics, Saint Petersburg State University<br>
</font></blockquote></div><br></div>