This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch ping**3
- From: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- To: Tobias Schl?ter <tobias dot schlueter at physik dot uni-muenchen dot de>
- Cc: GCC Fortran mailing list <fortran at gcc dot gnu dot org>, patch <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 30 Apr 2005 10:04:10 -0700
- Subject: Re: Patch ping**3
- References: <42501754.1030902@physik.uni-muenchen.de>
On Sun, Apr 03, 2005 at 06:18:28PM +0200, Tobias Schl?ter wrote:
>
> I'll have a little bit of time next week so I would really appreciate if those
> would get approved by then. I also think that the first patch might be
> considered release-critical (well, you know ...), as without it gfortran can't
> be used as drop-in replacement for g77 in the presence of precompiled libraries.
>
> 2005-03-08 [gfortran] Fix PR 20178: Implement g77 / f2c calling conventions
> mail here: http://gcc.gnu.org/ml/fortran/2005-03/msg00126.html
> patch here: http://gcc.gnu.org/ml/fortran/2005-03/msg00129.html
> one-line fix here: http://gcc.gnu.org/ml/fortran/2005-03/msg00163.html
>
I finally got around to testing the g77/f2c calling convention patch.
It does not work. Consider
kargl[215] cat t1.f
subroutine prn_val(x)
real x
print *, 'x = ', x
end
kargl[216] cat t2.f
program t2
real x
x = 1.
call prn_val(x)
end
Compile t1.f with g77 and compile t2.f with gfortran
kargl[222] f77 -c t1.f
kargl[223] gfc41 -static -o z -ff2c t2.f t1.o -lg2c
/var/tmp/ccieIxG9.o(.text+0x16): In function `MAIN__':
: undefined reference to `prn_val_'
collect2: ld returned 1 exit status
kargl[224] nm t1.o | grep prn
00000000 T prn_val__
If the code is changed from prn_val to prnval. Everything works
as expected. It appears that the author of g77 made a questionable
decision with the method of appending underscores to procedure names.
If the intent of your patch is to allow gfortran to use old g77
libraries without requiring recompilation of the old libraries
with gfortran, then I think your patch is doomed unless you can
dynamically determine when one or two underscores are present.
A case in point, here is some output from my libm77 library that
was compiled with g77.
kargl[231] nm ~/work/tests/m77/libm77.a | grep dsjn
dsjn_sc.o:
00000000 T dsjn_sc__
dsjn.o:
00000000 T dsjn_
--
Steve