Porting Fortran

Tobias Burnus burnus@net-b.de
Wed Mar 6 11:36:00 GMT 2013


Sudha Sarita wrote:
> I am trying to port gfortran for a 32 bit target architecture. The gnu
> toolchain including c and c++ compilers are already ported to the target.
> The gcc version used is 4.1.2. What are the files I need to modify for the
> same purpose? Is there any document specific to gfortran porting ? Any help
> will be really appreciated.

I would start by simply trying to compile gfortran by adding "fortran" 
to the --enable-languages= list. The chances are extremely high that it 
simply works. If it doesn't, one can check the build failures. After it 
build, you should run the regression test suite to test whether it 
really works.

The compiler itself ("gfortran" alias "f951") should simply rely on the 
same target-dependent code as C/C++ do. That's unless some mistake has 
been made with porting which is (only) exposed by the Fortran part or 
some special target case has not been honored by the Fortran FE. More 
likely is a failure to build libgfortran, but that usually requires only 
minor modifications; after all, GCC/gfortran already builds and works on 
more than a dozen target architectures.

As a side note: GCC 4.1 is already quite old. While GCC 4.1.2's Fortran 
compiler is quite usable, many bugs have been fixed in newer version. 
(Recall that gfortran was only added with GCC 4.0.) But I assume you 
have to stick to 4.1.2 if the target porting has been done to that 
system. However, if the system is supported by the upstream version of 
GCC, I would highly recommend to switch to a newer, supported version.

Tobias



More information about the Fortran mailing list