about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-03-16 07:40:05 +0000
committerUlrich Drepper <drepper@redhat.com>2001-03-16 07:40:05 +0000
commita986484f67346b28ff09833c1f4fd3505b52138e (patch)
tree598498dabf381610b1d7e27815917d67426bc34a /sysdeps/unix/sysv/linux
parent328c5f650ffcdc8f10e4ebd6f741ad0b8e6ea1c1 (diff)
downloadglibc-a986484f67346b28ff09833c1f4fd3505b52138e.tar.gz
glibc-a986484f67346b28ff09833c1f4fd3505b52138e.tar.xz
glibc-a986484f67346b28ff09833c1f4fd3505b52138e.zip
Update.
2001-03-12  Jakub Jelinek  <jakub@redhat.com>

	* csu/Makefile (abi-tag.h): Define OS and version separately, allow
	version to be overriden from config.h.
	* csu/abi-note.S: Use OS and version separately, include config.h.
	* elf/dl-load.c (_dl_osversion): New.
	(_dl_map_object_from_fd): Kill some warnings.
	(open_verify): Check .note.ABI-tag of the library if present.
	* elf/Makefile (CPPFLAGS-dl-load.c): Add -I$(csu-objpfx).
	* elf/cache.c (struct cache_entry): Add osversion.
	(print_entry): Print osversion.
	(print_cache): Pass osversion to it.
	(compare): Sort according to osversion.
	(save_cache): Set osversion.
	(add_to_cache): Add osversion argument.
	* sysdeps/generic/ldconfig.h (add_to_cache, process_file,
	process_elf_file): Add osversion argument.
	* elf/readlib.c (process_file): Likewise.
	* sysdeps/generic/readelflib.c (process_elf_file): Likewise.
	* sysdeps/unix/sysv/linux/ia64/readelflib.c (process_elf_file,
	process_elf32_file, process_elf64_file): Likewise.
	* sysdeps/unix/sysv/linux/i386/readelflib.c (process_elf_file,
	process_elf32_file, process_elf64_file): Likewise.
	* sysdeps/unix/sysv/linux/sparc/readelflib.c (process_elf_file,
	process_elf32_file, process_elf64_file): Likewise.
	* elf/ldconfig.c (manual_link): Pass it.
	(search_dir): Issue diagnostic if two libs with the same soname in
	the same directory have different .note.ABI-tag.  Record osversion in
	dlib_entry and use it from there.
	(struct lib_entry): Remove.
	(struct dlib_entry): Add osversion.
	* sysdeps/generic/dl-cache.c (_dl_load_cache_lookup): Check
	osversion.
	* sysdeps/generic/dl-cache.h (struct file_entry_new): Replace __unused
	field with osversion.
	* sysdeps/generic/ldsodefs.h (_dl_osversion): Declare.
	* sysdeps/unix/sysv/linux/init-first.c: Include ldsodefs.h.
	* sysdeps/unix/sysv/linux/dl-osinfo.h (DL_SYSDEP_OSCHECK): Save kernel
	version in _dl_osversion.
	* sysdeps/unix/sysv/linux/configure.in: Define __ABI_TAG_VERSION.
	* Makerules (build-shlib-helper, build-module-helper): New.
	(build-shlib, build-module-helper): Make sure .note.ABI-tag comes
	early.
	* config.h.in (__ABI_TAG_VERSION): Add.
	* elf/dl-minimal.c (__strtoul_internal): Set endptr on return.
	* sysdeps/unix/sysv/linux/i386/dl-librecon.h (EXTRA_LD_ENVVARS):
	Handle LD_ASSUME_KERNEL.
	* sysdeps/unix/sysv/linux/dl-librecon.h: New.
Diffstat (limited to 'sysdeps/unix/sysv/linux')
-rw-r--r--sysdeps/unix/sysv/linux/configure5
-rw-r--r--sysdeps/unix/sysv/linux/configure.in2
-rw-r--r--sysdeps/unix/sysv/linux/dl-librecon.h49
-rw-r--r--sysdeps/unix/sysv/linux/dl-osinfo.h2
-rw-r--r--sysdeps/unix/sysv/linux/i386/dl-librecon.h23
-rw-r--r--sysdeps/unix/sysv/linux/i386/readelflib.c19
-rw-r--r--sysdeps/unix/sysv/linux/ia64/readelflib.c19
-rw-r--r--sysdeps/unix/sysv/linux/init-first.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/readelflib.c21
9 files changed, 114 insertions, 27 deletions
diff --git a/sysdeps/unix/sysv/linux/configure b/sysdeps/unix/sysv/linux/configure
index e6d4a7d029..fc5297de26 100644
--- a/sysdeps/unix/sysv/linux/configure
+++ b/sysdeps/unix/sysv/linux/configure
@@ -87,6 +87,7 @@ if test -n "$minimum_kernel"; then
   echo $ac_n "checking for kernel header at least $minimum_kernel""... $ac_c" 1>&6
 echo "configure:89: checking for kernel header at least $minimum_kernel" >&5
   decnum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/(\1 * 65536 + \2 * 256 + \3)/'`;
+  abinum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1,\2,\3/'`;
   cat > conftest.$ac_ext <<EOF
 #line 92 "configure"
 #include "confdefs.h"
@@ -111,6 +112,10 @@ rm -f conftest*
 #define __LINUX_KERNEL_VERSION $decnum
 EOF
 
+    cat >> confdefs.h <<EOF
+#define __ABI_TAG_VERSION $abinum
+EOF
+
   else
     { echo "configure: error: *** The available kernel headers are older than the requested
 *** compatible kernel version" 1>&2; exit 1; }
diff --git a/sysdeps/unix/sysv/linux/configure.in b/sysdeps/unix/sysv/linux/configure.in
index 7d538e8d51..afe798218a 100644
--- a/sysdeps/unix/sysv/linux/configure.in
+++ b/sysdeps/unix/sysv/linux/configure.in
@@ -74,6 +74,7 @@ if test -n "$minimum_kernel"; then
   AC_MSG_CHECKING(for kernel header at least $minimum_kernel)
 changequote(,)dnl
   decnum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/(\1 * 65536 + \2 * 256 + \3)/'`;
+  abinum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1,\2,\3/'`;
 changequote([,])dnl
   AC_EGREP_CPP([eat flaming death], [#include <linux/version.h>
 #if LINUX_VERSION_CODE < $decnum
@@ -82,6 +83,7 @@ eat flaming death
   AC_MSG_RESULT($libc_minimum_kernel)
   if test "$libc_minimum_kernel" = ok; then
     AC_DEFINE_UNQUOTED(__LINUX_KERNEL_VERSION, $decnum)
+    AC_DEFINE_UNQUOTED(__ABI_TAG_VERSION, $abinum)
   else
     AC_MSG_ERROR([*** The available kernel headers are older than the requested
 *** compatible kernel version])
diff --git a/sysdeps/unix/sysv/linux/dl-librecon.h b/sysdeps/unix/sysv/linux/dl-librecon.h
new file mode 100644
index 0000000000..843e87485b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/dl-librecon.h
@@ -0,0 +1,49 @@
+/* Optional code to distinguish library flavours.
+   Copyright (C) 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2001.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _DL_LIBRECON_H
+#define _DL_LIBRECON_H	1
+
+/* Recognizing extra environment variables.  */
+#define EXTRA_LD_ENVVARS \
+  case 13:								      \
+    if (memcmp (&envline[3], "ASSUME_KERNEL", 13) == 0)			      \
+      {									      \
+	unsigned long int i, j, osversion = 0;				      \
+	char *p = &envline[17], *q;					      \
+									      \
+	for (i = 0; i < 3; i++, p = q + 1)				      \
+	  {								      \
+	    j = __strtoul_internal (p, &q, 0, 0);			      \
+	    if (j >= 255 || p == q || (i < 2 && *q && *q != '.'))	      \
+	      {								      \
+		osversion = 0;						      \
+		break;							      \
+	      }								      \
+	    osversion |= j << (16 - 8 * i);				      \
+	    if (!*q)							      \
+	      break;							      \
+	  }								      \
+	if (osversion)							      \
+	  _dl_osversion = osversion;					      \
+	break;								      \
+      }
+
+#endif /* dl-librecon.h */
diff --git a/sysdeps/unix/sysv/linux/dl-osinfo.h b/sysdeps/unix/sysv/linux/dl-osinfo.h
index a56f8e6dc0..e9bacf430c 100644
--- a/sysdeps/unix/sysv/linux/dl-osinfo.h
+++ b/sysdeps/unix/sysv/linux/dl-osinfo.h
@@ -102,5 +102,7 @@ dl_fatal (const char *str)
 	if (version < __LINUX_KERNEL_VERSION)				      \
 	  /* Not sufficent.  */						      \
 	  FATAL ("FATAL: kernel too old\n");				      \
+									      \
+	_dl_osversion = version;					      \
       }									      \
   } while (0)
diff --git a/sysdeps/unix/sysv/linux/i386/dl-librecon.h b/sysdeps/unix/sysv/linux/i386/dl-librecon.h
index 7d486c5d91..26311b32e4 100644
--- a/sysdeps/unix/sysv/linux/i386/dl-librecon.h
+++ b/sysdeps/unix/sysv/linux/i386/dl-librecon.h
@@ -48,6 +48,29 @@
 
 /* Recognizing extra environment variables.  */
 #define EXTRA_LD_ENVVARS \
+  case 13:								      \
+    if (memcmp (&envline[3], "ASSUME_KERNEL", 13) == 0)			      \
+      {									      \
+	unsigned long int i, j, osversion = 0;				      \
+	char *p = &envline[17], *q;					      \
+									      \
+	for (i = 0; i < 3; i++, p = q + 1)				      \
+	  {								      \
+	    j = __strtoul_internal (p, &q, 0, 0);			      \
+	    if (j >= 255 || p == q || (i < 2 && *q && *q != '.'))	      \
+	      {								      \
+		osversion = 0;						      \
+		break;							      \
+	      }								      \
+	    osversion |= j << (16 - 8 * i);				      \
+	    if (!*q)							      \
+	      break;							      \
+	  }								      \
+	if (osversion)							      \
+	  _dl_osversion = osversion;					      \
+	break;								      \
+      }									      \
+									      \
   case 15:								      \
     if (memcmp (&envline[3], "LIBRARY_VERSION", 15) == 0)		      \
       {									      \
diff --git a/sysdeps/unix/sysv/linux/i386/readelflib.c b/sysdeps/unix/sysv/linux/i386/readelflib.c
index f8868bb083..cc219d2c3f 100644
--- a/sysdeps/unix/sysv/linux/i386/readelflib.c
+++ b/sysdeps/unix/sysv/linux/i386/readelflib.c
@@ -20,23 +20,24 @@
 
 
 int process_elf32_file (const char *file_name, const char *lib, int *flag,
-			char **soname, void *file_contents,
-			size_t file_length);
+			unsigned int *osversion, char **soname,
+			void *file_contents, size_t file_length);
 int process_elf64_file (const char *file_name, const char *lib, int *flag,
-			char **soname, void *file_contents,
-			size_t file_length);
+			unsigned int *osversion, char **soname,
+			void *file_contents, size_t file_length);
 
 /* Returns 0 if everything is ok, != 0 in case of error.  */
 int
 process_elf_file (const char *file_name, const char *lib, int *flag,
-		  char **soname, void *file_contents, size_t file_length)
+		  unsigned int *osversion, char **soname, void *file_contents,
+		  size_t file_length)
 {
   ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents;
   int ret;
 
   if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
-    return process_elf32_file (file_name, lib, flag, soname, file_contents,
-			       file_length);
+    return process_elf32_file (file_name, lib, flag, osversion, soname,
+			       file_contents, file_length);
   else
     {
       switch (elf_header->e_machine)
@@ -50,8 +51,8 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
 	  return 1;
 	}
 
-      ret = process_elf64_file (file_name, lib, flag, soname, file_contents,
-				file_length);
+      ret = process_elf64_file (file_name, lib, flag, osversion, soname,
+				file_contents, file_length);
       /* IA64/X86-64 64bit libraries are always libc.so.6+.  */
       if (!ret)
 	switch (elf_header->e_machine)
diff --git a/sysdeps/unix/sysv/linux/ia64/readelflib.c b/sysdeps/unix/sysv/linux/ia64/readelflib.c
index 29a402ba68..efc699fb05 100644
--- a/sysdeps/unix/sysv/linux/ia64/readelflib.c
+++ b/sysdeps/unix/sysv/linux/ia64/readelflib.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001 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
@@ -18,25 +18,28 @@
 
 
 int process_elf32_file (const char *file_name, const char *lib, int *flag,
-			char **soname, void *file_contents, size_t file_length);
+			unsigned int *osversion, char **soname,
+			void *file_contents, size_t file_length);
 int process_elf64_file (const char *file_name, const char *lib, int *flag,
-			char **soname, void *file_contents, size_t file_length);
+			unsigned int *osversion, char **soname,
+			void *file_contents, size_t file_length);
 
 /* Returns 0 if everything is ok, != 0 in case of error.  */
 int
 process_elf_file (const char *file_name, const char *lib, int *flag,
-		  char **soname, void *file_contents, size_t file_length)
+		  unsigned int *osversion, char **soname,
+		  void *file_contents, size_t file_length)
 {
   ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents;
   int ret;
 
   if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
-    return process_elf32_file (file_name, lib, flag, soname, file_contents,
-				file_length);
+    return process_elf32_file (file_name, lib, flag, osversion, soname,
+			       file_contents, file_length);
   else
     {
-      ret = process_elf64_file (file_name, lib, flag, soname, file_contents,
-				 file_length);
+      ret = process_elf64_file (file_name, lib, flag, osversion, soname,
+				file_contents, file_length);
       /* Intel 64bit libraries are always libc.so.6+.  */
       if (!ret)
 	*flag = FLAG_IA64_LIB64|FLAG_ELF_LIBC6;
diff --git a/sysdeps/unix/sysv/linux/init-first.c b/sysdeps/unix/sysv/linux/init-first.c
index 512a69665b..017878a9e5 100644
--- a/sysdeps/unix/sysv/linux/init-first.c
+++ b/sysdeps/unix/sysv/linux/init-first.c
@@ -29,6 +29,7 @@
 #include <libc-internal.h>
 
 #ifndef SHARED
+# include <ldsodefs.h>
 # include "dl-osinfo.h"
 #endif
 
diff --git a/sysdeps/unix/sysv/linux/sparc/readelflib.c b/sysdeps/unix/sysv/linux/sparc/readelflib.c
index f5006278bb..f8d383e1f7 100644
--- a/sysdeps/unix/sysv/linux/sparc/readelflib.c
+++ b/sysdeps/unix/sysv/linux/sparc/readelflib.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Andreas Jaeger <aj@suse.de>, 1999 and
 		  Jakub Jelinek <jakub@redhat.com>, 1999.
@@ -20,27 +20,28 @@
 
 
 int process_elf32_file (const char *file_name, const char *lib, int *flag,
-			char **soname, void *file_contents,
-			size_t file_length);
+			unsigned int *osversion, char **soname,
+			void *file_contents, size_t file_length);
 int process_elf64_file (const char *file_name, const char *lib, int *flag,
-			char **soname, void *file_contents,
-			size_t file_length);
+			unsigned int *osversion, char **soname,
+			void *file_contents, size_t file_length);
 
 /* Returns 0 if everything is ok, != 0 in case of error.  */
 int
 process_elf_file (const char *file_name, const char *lib, int *flag,
-		  char **soname, void *file_contents, size_t file_length)
+		  unsigned int *osversion, char **soname, void *file_contents,
+		  size_t file_length)
 {
   ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents;
   int ret;
 
   if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
-    return process_elf32_file (file_name, lib, flag, soname, file_contents,
-			       file_length);
+    return process_elf32_file (file_name, lib, flag, osversion, soname,
+			       file_contents, file_length);
   else
     {
-      ret = process_elf64_file (file_name, lib, flag, soname, file_contents,
-				file_length);
+      ret = process_elf64_file (file_name, lib, flag, osversion, soname,
+				file_contents, file_length);
       /* Sparc 64bit libraries are always libc.so.6+.  */
       if (!ret)
 	*flag = FLAG_SPARC_LIB64|FLAG_ELF_LIBC6;