Subject: bin/7672: annoying and unnecessary linker "warnings"
To: None <gnats-bugs@gnats.netbsd.org>
From: None <woods@mail.weird.com>
List: netbsd-bugs
Date: 05/30/1999 12:50:55
>Number: 7672
>Category: bin
>Synopsis: annoying and unnecessary linker "warnings"
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun May 30 12:50:01 1999
>Last-Modified:
>Originator: Greg A. Woods
>Organization:
Planix, Inc.; Toronto, Ontario; Canada
>Release: 1.3I & 1.4 i386
>Environment:
System: NetBSD 1.3I i386
Compiler: gcc version 2.7.2.2+myc2
System: NetBSD 1.4 i386
Compiler: gcc version egcs-2.91.60 19981201 (egcs-1.1.1 release)
>Description:
The NetBSD linker has been configured to give helpful warnings
to the programmer, such as:
walk.o: warning: reference to compatibility glob(); include <glob.h> for correct reference
Unfortunately this warning is totally wrong in this case because
glob() is being defined by the program itself (in another source
file) and no reference is ever made to the glob() in the system
libraries.
>How-To-Repeat:
compile the following two files and link the resulting objects
together:
---------- glob.c ----------
int glob(int foo)
{
return foo;
}
---------- end ----------
---------- main.c ----------
int glob(int);
int main()
{
glob(1);
}
---------- end ----------
14:16 [189] $ cc main.c glob.c
/tmp/ccOuRD9q.o: warning: reference to compatibility glob(); include <glob.h> for correct reference
>Fix:
fix the linker to only utter such warnings if the system
supplied functions are actually used to fulfil the references.
I thought it worked this way already, but obviously it
doesn't....
It is interesting to note that if the application's function
definition (not just declaration) occurs within the same source
file, even without a "static" qualifier, no warning is issued.
It does not happen on 1.3.3 i386 or 1.3.2 sparc either...
BTW, is there some way to have the linker warn about globals
that have been seen either in objects or previous libraries and
which are also found in later libraries?
>Audit-Trail:
>Unformatted: