Subject: bin/14222: new toolchain's g77 won't compile and link anything
To: None <gnats-bugs@gnats.netbsd.org>
From: None <jbernard@mines.edu>
List: netbsd-bugs
Date: 10/10/2001 22:15:41
>Number: 14222
>Category: bin
>Synopsis: new toolchain's g77 won't compile and link anything
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Oct 10 21:17:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Jim Bernard
>Release: October 6, 2001
>Organization:
>Environment:
System: NetBSD roc 1.5Y NetBSD 1.5Y (ROC-$Revision: 1.8 $) #0: Sat Oct 6 15:16:01 MDT 2001 jim@roc:/tmp/compile/sys/arch/i386/compile/ROC i386
Architecture: i386
Machine: i386
>Description:
The version of g77 in the new toolchain (gcc 2.95.3) is unable to
compile and link any fortran programs. The errors given are:
/usr/lib/libg2c.so: undefined reference to `G77_vxtidate_y2kbuggy_0'
/usr/lib/libg2c.so: undefined reference to `G77_date_y2kbuggy_0'
The origin of the problem appears to be that these undefined text
symbols were intentionally introduced into libg2c to help locate
y2k problems in fortran code. (See:
info g77 Compiler "Run-time Environment Limits" "Year 2000 (Y2K) Problems"
for the details.)
Unfortunately, this means it is now impossible to write a fortran
program that will link, because this trap is triggered even if there
is no source code whatsoever (and certainly no intrinsics, y2k
noncompliant or otherwise) in the program, except for the required
END statement!
I suspect what happens is that the linker tries to resolve all
references to all the text symbols it finds in any referenced library,
regardless of whether they are actually required to link the program.
Thus, it always trips over the undefined symbols and refuses to
generate an output file.
>How-To-Repeat:
Create the most trivial of all fortran programs and try to compile it:
echo " end" > x.f
f77 x.f
>Fix:
Change the behavior of the linker or removed undefined symbols from
libg2c?
This would be a critical show stopper for anyone who uses fortran
or for any packages that require the fortran compiler, except for
the fact that it's possible to work around the problem by passing
the -noinhibit-exec flag to the linker:
f77 -Wl,-noinhibit-exec x.f
>Release-Note:
>Audit-Trail:
>Unformatted: