about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2004-11-10 09:38:27 +0000
committerJakub Jelinek <jakub@redhat.com>2004-11-10 09:38:27 +0000
commit9abf55c24c31a53d987ebf53e46cbd64eab417bc (patch)
tree15f35d8593a250d25b17a593b73a451ed20d0bd9
parent3504bb650f48534549bbd0313dc15fa71455e302 (diff)
downloadglibc-9abf55c24c31a53d987ebf53e46cbd64eab417bc.tar.gz
glibc-9abf55c24c31a53d987ebf53e46cbd64eab417bc.tar.xz
glibc-9abf55c24c31a53d987ebf53e46cbd64eab417bc.zip
-rw-r--r--elf/tst-dlmopen3.c1
-rw-r--r--sysdeps/gnu/Makefile8
-rw-r--r--sysdeps/gnu/errlist-compat.awk8
-rw-r--r--sysdeps/gnu/errlist.awk11
-rw-r--r--sysdeps/gnu/errlist.c10
5 files changed, 32 insertions, 6 deletions
diff --git a/elf/tst-dlmopen3.c b/elf/tst-dlmopen3.c
index da951ca806..26c86b2dca 100644
--- a/elf/tst-dlmopen3.c
+++ b/elf/tst-dlmopen3.c
@@ -1,6 +1,5 @@
 #include <dlfcn.h>
 #include <stdio.h>
-#include <gnu/lib-names.h>
 
 
 static int
diff --git a/sysdeps/gnu/Makefile b/sysdeps/gnu/Makefile
index dee0c67bcf..0fc33213ae 100644
--- a/sysdeps/gnu/Makefile
+++ b/sysdeps/gnu/Makefile
@@ -49,10 +49,14 @@ endif
 # Make it unwritable so noone will edit it by mistake.
 	-chmod a-w $@T
 	mv -f $@T $@
-generated += errlist-compat.c
+$(objpfx)errlist-compat.h: $(objpfx)errlist-compat.c
+	sed -n '1p;/ERR_MAX/p' $< > $@T
+	-chmod a-w $@T
+	mv -f $@T $@
+generated += errlist-compat.c errlist-compat.h
 
 # This will force the generation above to happy if need be.
-$(foreach o,.d $(object-suffixes),$(objpfx)errlist$o):$(objpfx)errlist-compat.c
+$(foreach o,.d $(object-suffixes),$(objpfx)errlist$o):$(objpfx)errlist-compat.h
 endif
 
 ifeq ($(subdir),login)
diff --git a/sysdeps/gnu/errlist-compat.awk b/sysdeps/gnu/errlist-compat.awk
index cb5798034d..db827f3f70 100644
--- a/sysdeps/gnu/errlist-compat.awk
+++ b/sysdeps/gnu/errlist-compat.awk
@@ -59,7 +59,7 @@ END {
 
   count = maxerr + 1;
 
-  if (highest != count) {
+  if (highest < count) {
     printf "*** errlist.c count %d vs Versions sys_errlist@%s count %d\n", \
       count, highest_version, highest > "/dev/stderr";
     exit 1;
@@ -79,6 +79,12 @@ END {
   print "/* This file was generated by errlist-compat.awk; DO NOT EDIT!  */\n";
   print "#include <shlib-compat.h>\n";
 
+  if (highest > count) {
+    printf "*** errlist.c count %d inflated to %s count %d (old errno.h?)\n", \
+      count, highest_version, highest > "/dev/stderr";
+    printf "#define ERR_MAX %d\n\n", highest;
+  }
+
   for (old in compat) {
     new = compat[old];
     n = vcount[old];
diff --git a/sysdeps/gnu/errlist.awk b/sysdeps/gnu/errlist.awk
index f8f7ba5335..3f074ed482 100644
--- a/sysdeps/gnu/errlist.awk
+++ b/sysdeps/gnu/errlist.awk
@@ -47,7 +47,16 @@ BEGIN {
     print "#endif";
     print "";
 
-    print "const char *const _sys_errlist_internal[] =";
+    print "#if !defined EMIT_ERR_MAX && !defined ERRLIST_NO_COMPAT";
+    print "# include <errlist-compat.h>";
+    print "#endif";
+    print "#ifdef ERR_MAX";
+    print "# define ERRLIST_SIZE ERR_MAX + 1";
+    print "#else"
+    print "# define ERRLIST_SIZE";
+    print "#endif";
+
+    print "const char *const _sys_errlist_internal[ERRLIST_SIZE] =";
     print "  {";
     print "    [0] = N_(\"Success\"),"
   }
diff --git a/sysdeps/gnu/errlist.c b/sysdeps/gnu/errlist.c
index 8131038047..9ae6ec3c1d 100644
--- a/sysdeps/gnu/errlist.c
+++ b/sysdeps/gnu/errlist.c
@@ -7,7 +7,15 @@
 # define ERR_REMAP(n) n
 #endif
 
-const char *const _sys_errlist_internal[] =
+#if !defined EMIT_ERR_MAX && !defined ERRLIST_NO_COMPAT
+# include <errlist-compat.h>
+#endif
+#ifdef ERR_MAX
+# define ERRLIST_SIZE ERR_MAX + 1
+#else
+# define ERRLIST_SIZE
+#endif
+const char *const _sys_errlist_internal[ERRLIST_SIZE] =
   {
     [0] = N_("Success"),
 #ifdef EPERM