Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 May 1998 02:51:40 +0000 (GMT)
From:      Terry Lambert <tlambert@primenet.com>
To:        jb@cimlogic.com.au (John Birrell)
Cc:        tlambert@primenet.com, current@FreeBSD.ORG
Subject:   Re: Undefined symbol "___error"
Message-ID:  <199805150251.TAA18202@usr01.primenet.com>
In-Reply-To: <199805140803.SAA25102@cimlogic.com.au> from "John Birrell" at May 14, 98 06:03:16 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> The problem reported by Bruce is this:
> 
> program (less) links against libtermcap.so (major version X) and libc.so
> (major version Y).
> 
> Some development takes place which causes the major version of libc to be
> bumped to Y + 1. The program still looks for libc version Y.

Was the libc version actually bumped?

> Then the __error() change is added to libc version Y + 1 and the header
> file that matches it. A rebuild of the system causes libtermcap still
> at version X to *need* the new __error() definition. So to ensure that
> the program is not broken, the version of libtermcap needs to be bumped
> to X + 1. This is a simple example.

Yes, but...

When the system is rebuilt, it it also linked against the rebuilt
libc.so.

Are we talking code that doesn't get rebuilt when the system is
rebuilt?  Ie: the system is *NOT* rebuilt, only *PART* of the system
is rebuilt?

If *PART* of the system *WASN'T* rebuilt, I now see the problem.  The
user is too lazy to be running -current.  ;-).



It seems to me that the fix would be (in errno.h) something like:

--------------------------------------------------------------------------
/*
 * Provide a weak accessor for the system errno for shared libraries
 * which reference the accessor via the definition, but are dynamically
 * linked into an application linked against older major versions of the
 * libc and therefore don't have the strong __error symbol defined.
 *
 * This is a hack to avoid doing the right thing, which is to bump
 * all other shared libraries major versions and maintain old copies
 * of all shared libraries required by old applications.
 *
 * Compilers other than GCC will probably need to handle this in other
 * ways. -- terry@lambert.org
 */
#ifdef __GCC__
#pragma weak	__error = ___error
static ___inline int *___error( void) { extern int errno; return &errno; }
#endif	/* __GCC__*/

#define	errno	(* __error)
--------------------------------------------------------------------------

This would give each library a weak accessor that would be overridden
by the real accessor if the thing got linked to the right libc, right?


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199805150251.TAA18202>