PATCH: Fix binary compatibility loss regarding errno
H. J. Lu
hjl@lucon.org
Mon Dec 30 14:12:00 GMT 2002
On Mon, Dec 30, 2002 at 01:41:07PM -0800, Roland McGrath wrote:
> > Here is a patch for errno. I don't know if there are any other similar
> > issuses.
>
> IIRC the cases of concern are errno. h_errno, and _res.
>
> Your patch needs to be conditionalized so it doesn't change the names for
> other builds.
Like this?
H.J.
---
2002-12-30 H.J. Lu <hjl@gnu.org>
* sysdeps/generic/errno.c (errno): Fix GLIBC_2_0 version.
(_errno): Likewise.
--- sysdeps/generic/errno.c.errno Fri Nov 22 10:22:46 2002
+++ sysdeps/generic/errno.c Mon Dec 30 14:08:45 2002
@@ -26,17 +26,23 @@ __thread int errno;
extern __thread int __libc_errno __attribute__ ((alias ("errno")))
attribute_hidden;
#else
+# if defined HAVE_ELF && defined SHARED && defined DO_VERSIONING
/* This differs from plain `int errno;' in that it doesn't create
a common definition, but a plain symbol that resides in .bss,
which can have an alias. */
-int errno __attribute__ ((section (".bss")));
-strong_alias (errno, _errno)
+int __old_errno __attribute__ ((section (".bss")));
+strong_alias (__old_errno, ___old_errno)
/* We declare these with compat_symbol so that they are not
visible at link time. Programs must use the accessor functions. */
-# if defined HAVE_ELF && defined SHARED && defined DO_VERSIONING
# include <shlib-compat.h>
-compat_symbol (libc, errno, errno, GLIBC_2_0);
-compat_symbol (libc, _errno, _errno, GLIBC_2_0);
+compat_symbol (libc, __old_errno, errno, GLIBC_2_0);
+compat_symbol (libc, ___old_errno, _errno, GLIBC_2_0);
+# else
+/* This differs from plain `int errno;' in that it doesn't create
+ a common definition, but a plain symbol that resides in .bss,
+ which can have an alias. */
+int errno __attribute__ ((section (".bss")));
+strong_alias (errno, _errno)
# endif
#endif
More information about the Libc-alpha
mailing list