[LLVMdev] llvm-gfortran problems

Dmitry N. Mikushin maemarcus at gmail.com
Wed Aug 31 14:26:49 PDT 2011


I successfully compiled your first sample program:

[marcusmae at zacate recursive]$ make
dragonegg-gfortran -fplugin=/opt/kgen/lib64/dragonegg.so
-fplugin-arg-dragonegg-emit-ir -emit-llvm -S recursive.f -o
recursive.bc
llc -march=x86-64 recursive.bc -o recursive.s
gfortran recursive.s -o recursive
[marcusmae at zacate recursive]$ ./recursive
 Enter number of repeats
10
 x =            1
 x =            2
 x =            3
 x =            4
 x =            5
 x =            6
 x =            7
 x =            8
 x =            9
 x =           10

Everything is in attached archive.

- D.

2011/9/1 Dmitry N. Mikushin <maemarcus at gmail.com>:
> Hi Ashay,
>
> Do you need specifically llvm-gfortran that is based on gcc 4.2? Since
> that, DragonEgg has been introduced - a powerful plugin to gcc that
> makes it possible to utilize regular gcc compilers as frontends to
> llvm: http://dragonegg.llvm.org/
>
> It generates Fortran90 programs for me very well.
>
> - D.
>
> 2011/9/1 Ashay Rane <ashay.rane at tacc.utexas.edu>:
>> 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
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: recursive.tar.gz
Type: application/x-gzip
Size: 6315 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110901/1269a22f/attachment-0001.bin>


More information about the llvm-dev mailing list