2002-08-26 Roland McGrath <roland@redhat.com>

* sysdeps/gnu/Versions: New file.
	* sysdeps/unix/sysv/linux/Versions (libc: GLIBC_2.1): Remove
	_sys_errlist; sys_errlist; _sys_nerr; sys_nerr; from here.
	* sysdeps/gnu/Makefile ($(..)sysdeps/gnu/errlist-compat.c): New target.
	($(objpfx)errlist.d): Depend on $(..)sysdeps/gnu/errlist-compat.c.
	* sysdeps/gnu/errlist.awk: Make output define _sys_errlist_internal
	and _sys_nerr_internal instead of anything else.  Make it include
	"errlist-compat.c" if [!NOT_IN_libc && !ERRLIST_NO_COMPAT].
	Make it emit some asm magic if [EMIT_ERR_MAX].
	* sysdeps/gnu/errlist.c: Regenerated.
	* sysdeps/gnu/errlist-compat.awk: New file.
	* sysdeps/gnu/errlist-compat.c: New file (generated).
	* sysdeps/mach/hurd/errlist.c (ERRLIST_NO_COMPAT): New macro.
	(_sys_errlist_internal): Define this as	a macro for _hurd_errlist.
	(_sys_nerr_internal): Define this is a macro for _hurd_nerr.
	(SYS_ERRLIST, SYS_NERR): Macros removed.
	(sys_nerr, _sys_nerr): Remove these weak aliases.
	* sysdeps/unix/sysv/linux/errlist.c: File removed.
	* sysdeps/unix/sysv/linux/errlist.h: File removed.
	* sysdeps/unix/sysv/linux/arm/errlist.c: File removed.
This commit is contained in:
Roland McGrath 2002-08-27 09:22:36 +00:00
parent b2ab1f5df8
commit 4022d8ed03
10 changed files with 792 additions and 175 deletions

View File

@ -1,4 +1,4 @@
# Copyright (C) 1996, 97, 98, 99 Free Software Foundation, Inc.
# Copyright (C) 1996,97,98,99,2001,02 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@ -29,6 +29,26 @@ ifeq ($(with-cvs),yes)
test ! -d CVS || cvs commit -m'Regenerated from $^' $@
endif
vpath errlist.c $(full_config_sysdirs)
$(..)sysdeps/gnu/errlist-compat.c: errlist.c \
$(..)sysdeps/gnu/errlist-compat.awk \
$(..)sysdeps/gnu/Versions
$(AWK) -v maxerr=`\
$(CC) -S $(CPPFLAGS) $(CFLAGS) -DNOT_IN_libc -DEMIT_ERR_MAX $< -o - \
| sed -n 's/^.*@@@[^0-9]*\([0-9]*\)[^0-9]*@@@.*$$/\1/p'` \
-f $(filter-out $<,$^) > $@T
# Make it unwritable so noone will edit it by mistake.
-chmod a-w $@T
mv -f $@T $@
ifeq ($(with-cvs),yes)
test ! -d CVS || cvs commit -m'Regenerated from $^' $@
endif
ifeq ($(subdir),stdio-common)
# This will force the generation above to happy if need be.
$(objpfx)errlist.d: $(..)sysdeps/gnu/errlist-compat.c
endif
ifeq ($(subdir),login)
sysdep_routines += setutxent getutxent endutxent getutxid getutxline \
pututxline utmpxname updwtmpx getutmpx getutmp

19
sysdeps/gnu/Versions Normal file
View File

@ -0,0 +1,19 @@
libc {
# The comment lines with "#errlist-compat" are magic; see errlist-compat.awk.
# When you get an error from errlist-compat.awk, you need to add a new
# version here. Don't do this blindly, since this means changing the ABI
# for all GNU/Linux configurations.
GLIBC_2.0 {
#errlist-compat 123
_sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
}
GLIBC_2.1 {
#errlist-compat 125
_sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
}
GLIBC_2.3 {
#errlist-compat 126
_sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
}
}

View File

@ -0,0 +1,104 @@
# awk script to generate errlist-compat.c
# Copyright (C) 2002 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
# The GNU C Library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public
# License along with the GNU C Library; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
# 02111-1307 USA.
#
# This script takes the Versions file as input and looks for #errlist-compat
# magic comments, which have the form:
# #errlist-compat NNN
# where NNN is the number of elements in the sys_errlist for that version set.
# We need the awk variable `maxerr' defined to the current size of sys_errlist.
#
# If there is no magic comment matching the current size, we barf.
# Otherwise we generate code (errlist-compat.c) to define all the
# necessary compatibility symbols for older, smaller versions of sys_errlist.
#
BEGIN { highest = 0 }
# These two rules catch the Versions file contents.
NF == 2 && $2 == "{" { last_version = $1; next }
$1 == "#errlist-compat" {
n = $2 + 0;
if (n < 100) {
print "*** this line seems bogus:", $0 > "/dev/stderr";
exit 1;
}
version[n] = last_version;
if (n > highest)
highest = n;
next;
}
END {
count = maxerr + 1;
if (highest != count) {
printf "*** errlist.c count %d vs Versions sys_errlist@%s count %d\n", \
count, version[highest], highest > "/dev/stderr";
exit 1;
}
lastv = "";
for (n = 0; n <= count; ++n)
if (n in version) {
v = version[n];
gsub(/[^A-Z0-9_]/, "_", v);
if (lastv != "")
compat[lastv] = v;
lastv = v;
vcount[v] = n;
}
print "/* This file was generated by errlist-compat.awk; DO NOT EDIT! */\n";
print "#include <shlib-compat.h>\n";
for (old in compat) {
new = compat[old];
n = vcount[old];
printf "#if SHLIB_COMPAT (libc, %s, %s)\n", old, new;
printf "extern const char *const __sys_errlist_%s[];\n", old;
printf "const int __sys_nerr_%s = %d;\n", old, n;
printf "strong_alias (_sys_errlist_internal, __sys_errlist_%s)\n", old;
printf "declare_symbol (__sys_errlist_%s, object, __WORDSIZE/8*%d)\n", \
old, n;
printf "compat_symbol (libc, __sys_errlist_%s, sys_errlist, %s);\n", \
old, old;
printf "compat_symbol (libc, __sys_nerr_%s, sys_nerr, %s);\n", old, old;
printf "extern const char *const ___sys_errlist_%s[];\n", old;
printf "extern const int __sys_nerr_%s;\n", old;
printf "strong_alias (__sys_errlist_%s, ___sys_errlist_%s)\n", old, old;
printf "strong_alias (__sys_nerr_%s, ___sys_nerr_%s)\n", old, old;
printf "compat_symbol (libc, ___sys_errlist_%s, _sys_errlist, %s);\n", \
old, old;
printf "compat_symbol (libc, ___sys_nerr_%s, _sys_nerr, %s);\n", old, old;
printf "#endif\n\n";
}
printf "\
extern const char *const __sys_errlist_internal[];\n\
extern const int __sys_nerr_internal;\n\
strong_alias (_sys_errlist_internal, __sys_errlist_internal)\n\
strong_alias (_sys_nerr_internal, __sys_nerr_internal)\n\
versioned_symbol (libc, _sys_errlist_internal, sys_errlist, %s);\n\
versioned_symbol (libc, __sys_errlist_internal, _sys_errlist, %s);\n\
versioned_symbol (libc, _sys_nerr_internal, sys_nerr, %s);\n\
versioned_symbol (libc, __sys_nerr_internal, _sys_nerr, %s);\n", \
lastv, lastv, lastv, lastv;
}

View File

@ -0,0 +1,42 @@
/* This file was generated by errlist-compat.awk; DO NOT EDIT! */
#include <shlib-compat.h>
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
extern const char *const __sys_errlist_GLIBC_2_0[];
const int __sys_nerr_GLIBC_2_0 = 123;
strong_alias (_sys_errlist_internal, __sys_errlist_GLIBC_2_0)
declare_symbol (__sys_errlist_GLIBC_2_0, object, __WORDSIZE/8*123)
compat_symbol (libc, __sys_errlist_GLIBC_2_0, sys_errlist, GLIBC_2_0);
compat_symbol (libc, __sys_nerr_GLIBC_2_0, sys_nerr, GLIBC_2_0);
extern const char *const ___sys_errlist_GLIBC_2_0[];
extern const int __sys_nerr_GLIBC_2_0;
strong_alias (__sys_errlist_GLIBC_2_0, ___sys_errlist_GLIBC_2_0)
strong_alias (__sys_nerr_GLIBC_2_0, ___sys_nerr_GLIBC_2_0)
compat_symbol (libc, ___sys_errlist_GLIBC_2_0, _sys_errlist, GLIBC_2_0);
compat_symbol (libc, ___sys_nerr_GLIBC_2_0, _sys_nerr, GLIBC_2_0);
#endif
#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_3)
extern const char *const __sys_errlist_GLIBC_2_1[];
const int __sys_nerr_GLIBC_2_1 = 125;
strong_alias (_sys_errlist_internal, __sys_errlist_GLIBC_2_1)
declare_symbol (__sys_errlist_GLIBC_2_1, object, __WORDSIZE/8*125)
compat_symbol (libc, __sys_errlist_GLIBC_2_1, sys_errlist, GLIBC_2_1);
compat_symbol (libc, __sys_nerr_GLIBC_2_1, sys_nerr, GLIBC_2_1);
extern const char *const ___sys_errlist_GLIBC_2_1[];
extern const int __sys_nerr_GLIBC_2_1;
strong_alias (__sys_errlist_GLIBC_2_1, ___sys_errlist_GLIBC_2_1)
strong_alias (__sys_nerr_GLIBC_2_1, ___sys_nerr_GLIBC_2_1)
compat_symbol (libc, ___sys_errlist_GLIBC_2_1, _sys_errlist, GLIBC_2_1);
compat_symbol (libc, ___sys_nerr_GLIBC_2_1, _sys_nerr, GLIBC_2_1);
#endif
extern const char *const __sys_errlist_internal[];
extern const int __sys_nerr_internal;
strong_alias (_sys_errlist_internal, __sys_errlist_internal)
strong_alias (_sys_nerr_internal, __sys_nerr_internal)
versioned_symbol (libc, _sys_errlist_internal, sys_errlist, GLIBC_2_3);
versioned_symbol (libc, __sys_errlist_internal, _sys_errlist, GLIBC_2_3);
versioned_symbol (libc, _sys_nerr_internal, sys_nerr, GLIBC_2_3);
versioned_symbol (libc, __sys_nerr_internal, _sys_nerr, GLIBC_2_3);

View File

@ -42,22 +42,16 @@ BEGIN {
print "#include <errno.h>";
print "#include <libintl.h>";
print "";
print "#ifndef SYS_ERRLIST";
print "# define SYS_ERRLIST _sys_errlist";
print "# define SYS_ERRLIST_ALIAS sys_errlist";
print "#endif";
print "#ifndef SYS_NERR";
print "# define SYS_NERR _sys_nerr";
print "# define SYS_NERR_ALIAS sys_nerr";
print "#endif";
print "#ifndef ERR_REMAP";
print "# define ERR_REMAP(n) n";
print "#endif";
print "";
print "const char *const SYS_ERRLIST[] =";
print "const char *const _sys_errlist_internal[] =";
print " {";
print " [0] = N_(\"Success\"),"
}
$1 == "@comment" && $2 == "errno.h" { errnoh=1; next }
errnoh == 1 && $1 == "@comment" \
{
@ -86,6 +80,10 @@ errnoh == 4 && $1 == "@end" && $2 == "deftypevr" \
{
printf "/*%s */\n", desc;
printf " [ERR_REMAP (%s)] = N_(\"%s\"),\n", e, etext;
printf "# if %s > ERR_MAX\n", e;
print "# undef ERR_MAX";
printf "# define ERR_MAX %s\n", e;
print "# endif";
print "#endif";
errnoh = 0;
next;
@ -99,13 +97,15 @@ errnoh == 4 \
END {
print " };";
print "";
print "const int SYS_NERR = sizeof SYS_ERRLIST / sizeof SYS_ERRLIST [0];";
print "#ifdef SYS_ERRLIST_ALIAS";
print "weak_alias (_sys_errlist, SYS_ERRLIST_ALIAS)";
print "const int _sys_nerr_internal";
print " = sizeof _sys_errlist_internal / sizeof _sys_errlist_internal [0];";
print "";
print "#if !defined NOT_IN_libc && !ERRLIST_NO_COMPAT";
print "# include \"errlist-compat.c\"";
print "#endif";
print "#ifdef SYS_NERR_ALIAS";
print "weak_alias (_sys_nerr, SYS_NERR_ALIAS)";
print "";
print "#ifdef EMIT_ERR_MAX";
print "void dummy (void)"
print "{ asm volatile (\" @@@ %0 @@@ \" : : \"i\" (ERR_REMAP (ERR_MAX))); }"
print "#endif";
print "INTVARDEF2(SYS_ERRLIST, _sys_errlist)";
print "INTVARDEF2(SYS_NERR, _sys_nerr)";
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1998 Free Software Foundation, Inc.
/* Copyright (C) 1998,2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -16,17 +16,14 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
/* SYS_ERRLIST cannot have Unix semantics on the Hurd, so it is easier
just to rename it. We also need to remap error codes to array
indices by taking their subcode. */
#define SYS_ERRLIST _hurd_errlist
#define SYS_NERR _hurd_nerr
/* sys_errlist cannot have Unix semantics on the Hurd, so it is easier just
to rename it. We also need to remap error codes to array indices by
taking their subcode. */
#define _sys_errlist_internal _hurd_errlist
#define _sys_nerr_internal _hurd_nerr
#define ERRLIST_NO_COMPAT 1
#include <mach/error.h>
#define ERR_REMAP(n) (err_get_code (n))
#include <sysdeps/gnu/errlist.c>
/* Oblige programs that use sys_nerr, but don't use sys_errlist. */
weak_alias (_hurd_nerr, sys_nerr)
weak_alias (_hurd_nerr, _sys_nerr)

View File

@ -1,53 +0,0 @@
/* Copyright (C) 1998, 2000, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <sizes.h>
#include <errlist.h>
#include <shlib-compat.h>
#define SYS_ERRLIST __new_sys_errlist
#define SYS_NERR __new_sys_nerr
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
asm (".data; .globl __old_sys_errlist; __old_sys_errlist:");
#endif
#include <sysdeps/gnu/errlist.c>
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
asm (".type __old_sys_errlist,%object;.size __old_sys_errlist,"
OLD_ERRLIST_SIZE_STR "*" PTR_SIZE_STR);
extern const char *const *__old_sys_errlist;
const int __old_sys_nerr = OLD_ERRLIST_SIZE;
strong_alias (__old_sys_nerr, _old_sys_nerr);
compat_symbol (libc, __old_sys_nerr, _sys_nerr, GLIBC_2_0);
compat_symbol (libc, _old_sys_nerr, sys_nerr, GLIBC_2_0);
strong_alias (__old_sys_errlist, _old_sys_errlist);
compat_symbol (libc, __old_sys_errlist, _sys_errlist, GLIBC_2_0);
compat_symbol (libc, _old_sys_errlist, sys_errlist, GLIBC_2_0);
#endif
strong_alias (__new_sys_nerr, _new_sys_nerr)
versioned_symbol (libc, __new_sys_nerr, _sys_nerr, GLIBC_2_1);
versioned_symbol (libc, _new_sys_nerr, sys_nerr, GLIBC_2_1);
strong_alias (__new_sys_errlist, _new_sys_errlist)
versioned_symbol (libc, __new_sys_errlist, _sys_errlist, GLIBC_2_1);
versioned_symbol (libc, _new_sys_errlist, sys_errlist, GLIBC_2_1);

View File

@ -1,53 +0,0 @@
/* Copyright (C) 1998, 2000, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <sizes.h>
#include <errlist.h>
#include <shlib-compat.h>
#define SYS_ERRLIST __new_sys_errlist
#define SYS_NERR __new_sys_nerr
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
asm (".data\n\t.globl __old_sys_errlist\n__old_sys_errlist:");
#endif
#include <sysdeps/gnu/errlist.c>
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
asm (".type __old_sys_errlist,@object\n\t.size __old_sys_errlist,"
OLD_ERRLIST_SIZE_STR "*" PTR_SIZE_STR);
extern const char *const *__old_sys_errlist;
const int __old_sys_nerr = OLD_ERRLIST_SIZE;
strong_alias (__old_sys_nerr, _old_sys_nerr);
compat_symbol (libc, __old_sys_nerr, _sys_nerr, GLIBC_2_0);
compat_symbol (libc, _old_sys_nerr, sys_nerr, GLIBC_2_0);
strong_alias (__old_sys_errlist, _old_sys_errlist);
compat_symbol (libc, __old_sys_errlist, _sys_errlist, GLIBC_2_0);
compat_symbol (libc, _old_sys_errlist, sys_errlist, GLIBC_2_0);
#endif
strong_alias (__new_sys_nerr, _new_sys_nerr)
versioned_symbol (libc, __new_sys_nerr, _sys_nerr, GLIBC_2_1);
versioned_symbol (libc, _new_sys_nerr, sys_nerr, GLIBC_2_1);
strong_alias (__new_sys_errlist, _new_sys_errlist)
versioned_symbol (libc, __new_sys_errlist, _sys_errlist, GLIBC_2_1);
versioned_symbol (libc, _new_sys_errlist, sys_errlist, GLIBC_2_1);

View File

@ -1,25 +0,0 @@
/* Copyright (C) 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _ERRLIST_H
#define _ERRLIST_H 1
#define OLD_ERRLIST_SIZE_STR "123"
#define OLD_ERRLIST_SIZE 123
#endif /* errlist.h */