aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/generic
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/generic
parent328c5f650ffcdc8f10e4ebd6f741ad0b8e6ea1c1 (diff)
downloadglibc-a986484f67346b28ff09833c1f4fd3505b52138e.tar
glibc-a986484f67346b28ff09833c1f4fd3505b52138e.tar.gz
glibc-a986484f67346b28ff09833c1f4fd3505b52138e.tar.bz2
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/generic')
-rw-r--r--sysdeps/generic/dl-cache.c2
-rw-r--r--sysdeps/generic/dl-cache.h2
-rw-r--r--sysdeps/generic/ldconfig.h10
-rw-r--r--sysdeps/generic/ldsodefs.h3
-rw-r--r--sysdeps/generic/readelflib.c22
5 files changed, 31 insertions, 8 deletions
diff --git a/sysdeps/generic/dl-cache.c b/sysdeps/generic/dl-cache.c
index 5e16f2852a..65135d467d 100644
--- a/sysdeps/generic/dl-cache.c
+++ b/sysdeps/generic/dl-cache.c
@@ -228,6 +228,8 @@ _dl_load_cache_lookup (const char *name)
/* Only accept hwcap if it's for the right platform. */
#define HWCAP_CHECK \
+ if (_dl_osversion && cache_new->libs[middle].osversion > _dl_osversion) \
+ continue; \
if (_DL_PLATFORMS_COUNT && platform != -1 \
&& (cache_new->libs[middle].hwcap & _DL_HWCAP_PLATFORM) != 0 \
&& (cache_new->libs[middle].hwcap & _DL_HWCAP_PLATFORM) != platform) \
diff --git a/sysdeps/generic/dl-cache.h b/sysdeps/generic/dl-cache.h
index 2d02dcf347..7938fc0b4a 100644
--- a/sysdeps/generic/dl-cache.h
+++ b/sysdeps/generic/dl-cache.h
@@ -76,7 +76,7 @@ struct file_entry_new
{
int32_t flags; /* This is 1 for an ELF library. */
uint32_t key, value; /* String table indices. */
- uint32_t __unused; /* Align next field always on 8 byte boundary. */
+ uint32_t osversion; /* Required OS version. */
uint64_t hwcap; /* Hwcap entry. */
};
diff --git a/sysdeps/generic/ldconfig.h b/sysdeps/generic/ldconfig.h
index aaad06de5d..0575f48c4b 100644
--- a/sysdeps/generic/ldconfig.h
+++ b/sysdeps/generic/ldconfig.h
@@ -39,17 +39,17 @@ extern void init_cache (void);
extern void save_cache (const char *cache_name);
extern void add_to_cache (const char *path, const char *lib, int flags,
- uint64_t hwcap);
+ unsigned int osversion, uint64_t hwcap);
/* Declared in readlib.c. */
extern int process_file (const char *real_file_name, const char *file_name,
- const char *lib, int *flag, char **soname,
- int is_link);
+ const char *lib, int *flag, unsigned int *osversion,
+ char **soname, int is_link);
/* Declared in readelflib.c. */
extern 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);
/* Declared in chroot_canon.c. */
extern char *chroot_canon (const char *chroot, const char *name);
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index 0575eaf9a9..bcdcf7dd4f 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -173,6 +173,9 @@ extern char **_dl_argv;
/* Cached value of `getpagesize ()'. */
extern size_t _dl_pagesize;
+/* OS version. */
+extern unsigned int _dl_osversion;
+
/* File descriptor referring to the zero-fill device. */
extern int _dl_zerofd;
diff --git a/sysdeps/generic/readelflib.c b/sysdeps/generic/readelflib.c
index 2797c282f5..5354526a25 100644
--- a/sysdeps/generic/readelflib.c
+++ b/sysdeps/generic/readelflib.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000, 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.
@@ -41,7 +41,8 @@ do \
/* 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)
{
int i;
unsigned int j;
@@ -56,6 +57,7 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
char *dynamic_strings;
elf_header = (ElfW(Ehdr) *) file_contents;
+ *osversion = 0;
if (elf_header->e_ident [EI_CLASS] != ElfW (CLASS))
{
@@ -110,6 +112,7 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
dynamic_addr = segment->p_offset;
dynamic_size = segment->p_filesz;
break;
+
case PT_INTERP:
program_interpreter = (char *) (file_contents + segment->p_offset);
check_ptr (program_interpreter);
@@ -123,6 +126,21 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
break;
}
break;
+
+ case PT_NOTE:
+ if (!*osversion && segment->p_filesz == 32 && segment->p_align >= 4)
+ {
+ ElfW(Word) *abi_note = (ElfW(Word) *) (file_contents
+ + segment->p_offset);
+ if (abi_note [0] == 4 && abi_note [1] == 16 && abi_note [2] == 1
+ && memcmp (abi_note + 3, "GNU", 4) == 0)
+ *osversion = (abi_note [4] << 24) |
+ ((abi_note [5] & 0xff) << 16) |
+ ((abi_note [6] & 0xff) << 8) |
+ (abi_note [7] & 0xff);
+ }
+ break;
+
default:
break;
}