aboutsummaryrefslogtreecommitdiff
path: root/elf/ldconfig.c
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 /elf/ldconfig.c
parent328c5f650ffcdc8f10e4ebd6f741ad0b8e6ea1c1 (diff)
downloadglibc-a986484f67346b28ff09833c1f4fd3505b52138e.zip
glibc-a986484f67346b28ff09833c1f4fd3505b52138e.tar.gz
glibc-a986484f67346b28ff09833c1f4fd3505b52138e.tar.bz2
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 'elf/ldconfig.c')
-rw-r--r--elf/ldconfig.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/elf/ldconfig.c b/elf/ldconfig.c
index 4c00bce..d3c5355 100644
--- a/elf/ldconfig.c
+++ b/elf/ldconfig.c
@@ -48,19 +48,11 @@
#define PACKAGE _libc_intl_domainname
-struct lib_entry
- {
- int flags;
- uint64_t hwcap;
- char *lib;
- char *path;
- };
-
static const struct
{
const char *name;
int flag;
-} lib_types [] =
+} lib_types[] =
{
{"libc4", FLAG_LIBC4},
{"libc5", FLAG_ELF_LIBC5},
@@ -316,7 +308,7 @@ add_dir (const char *line)
*equal_sign = '\0';
++equal_sign;
entry->flag = FLAG_ANY;
- for (i = 0; i < sizeof (lib_types) / sizeof (lib_types [0]); ++i)
+ for (i = 0; i < sizeof (lib_types) / sizeof (lib_types[0]); ++i)
if (strcmp (equal_sign, lib_types[i].name) == 0)
{
entry->flag = lib_types[i].flag;
@@ -334,7 +326,7 @@ add_dir (const char *line)
i = strlen (entry->path) - 1;
while (entry->path[i] == '/' && i > 0)
{
- entry->path [i] = '\0';
+ entry->path[i] = '\0';
--i;
}
@@ -460,6 +452,7 @@ manual_link (char *library)
char *soname;
struct stat64 stat_buf;
int flag;
+ unsigned int osversion;
/* Prepare arguments for create_links call. Split library name in
directory and filename first. Since path is allocated, we've got
@@ -524,7 +517,8 @@ manual_link (char *library)
free (path);
return;
}
- if (process_file (real_library, library, libname, &flag, &soname, 0))
+ if (process_file (real_library, library, libname, &flag, &osversion,
+ &soname, 0))
{
error (0, 0, _("No link created since soname could not be found for %s"),
library);
@@ -568,6 +562,7 @@ struct dlib_entry
char *soname;
int flag;
int is_link;
+ unsigned int osversion;
struct dlib_entry *next;
};
@@ -585,6 +580,7 @@ search_dir (const struct dir_entry *entry)
struct stat64 stat_buf;
int is_link;
uint64_t hwcap = path_hwcap (entry->path);
+ unsigned int osversion;
file_name_len = PATH_MAX;
file_name = alloca (file_name_len);
@@ -700,7 +696,7 @@ search_dir (const struct dir_entry *entry)
real_name = real_file_name;
if (process_file (real_name, file_name, direntry->d_name, &flag,
- &soname, is_link))
+ &osversion, &soname, is_link))
{
if (real_name != real_file_name)
free (real_name);
@@ -762,6 +758,11 @@ search_dir (const struct dir_entry *entry)
error (0, 0, _("libraries %s and %s in directory %s have same soname but different type."),
dlib_ptr->name, direntry->d_name, entry->path);
}
+ /* OS version should be the same - sanity check. */
+ if (dlib_ptr->osversion != osversion)
+ error (0, 0, _("libraries %s and %s in directory %s have same\n"
+ "soname but different minimal supported OS version."),
+ dlib_ptr->name, direntry->d_name, entry->path);
free (dlib_ptr->name);
dlib_ptr->name = xstrdup (direntry->d_name);
dlib_ptr->is_link = is_link;
@@ -778,6 +779,7 @@ search_dir (const struct dir_entry *entry)
dlib_ptr = (struct dlib_entry *)xmalloc (sizeof (struct dlib_entry));
dlib_ptr->name = xstrdup (direntry->d_name);
dlib_ptr->flag = flag;
+ dlib_ptr->osversion = osversion;
dlib_ptr->soname = soname;
dlib_ptr->is_link = is_link;
/* Add at head of list. */
@@ -797,7 +799,8 @@ search_dir (const struct dir_entry *entry)
create_links (dir_name, entry->path, dlib_ptr->name,
dlib_ptr->soname);
if (opt_build_cache)
- add_to_cache (entry->path, dlib_ptr->soname, dlib_ptr->flag, hwcap);
+ add_to_cache (entry->path, dlib_ptr->soname, dlib_ptr->flag,
+ dlib_ptr->osversion, hwcap);
}
/* Free all resources. */
@@ -909,7 +912,7 @@ main (int argc, char **argv)
{
int i;
for (i = remaining; i < argc; ++i)
- add_dir (argv [i]);
+ add_dir (argv[i]);
}
if (opt_chroot)
@@ -990,7 +993,7 @@ main (int argc, char **argv)
int i;
for (i = remaining; i < argc; ++i)
- manual_link (argv [i]);
+ manual_link (argv[i]);
exit (0);
}