Subject: Re: lib/14325: linking with '-static -lresolv' fails due to "multiple definition of `__res_opt'"
To: None <gnats-admin@netbsd.org>
From: Greg A. Woods <woods@weird.com>
List: netbsd-bugs
Date: 10/22/2001 20:29:59
I just realised there are two other possible fixes, though neither are
likely to be suitable.

1. remove resolver routines from libc  -- this of course would require a
   lot of work since many programs now assume resolver routines are
   available in libc.

2. don't ever define global variables in any module which uses
   __weak_alias() -- this of course would make it possible for two
   potentially different code segments to be included in a given program
   resulting in potentially different code paths for otherwise identical
   calls.

Maybe it would be best if the linker could complain when a definition
for a weakly defined symbol is used after a definition of a non-weak
version of the same symbol has already been included.  I guess the
problem with that would be figuring out when a reference is being made
to the non-weak symbol associated with a weak symbol.  At the moment it
appears as though lib/libc/include/namespace.h is blatantly bypassing
the weak symbol handling for internal references to the weak symbols
within libc, and doing so with #define so that the linker realy can't
tell for sure if that's what's happening.

-- 
							Greg A. Woods

+1 416 218-0098      VE3TCP      <gwoods@acm.org>     <woods@robohack.ca>
Planix, Inc. <woods@planix.com>;   Secrets of the Weird <woods@weird.com>