glibc/elf/readlib.c

183 lines
5.1 KiB
C
Raw Normal View History

* catgets/gencat.c: Use GPL, not LGPL. * elf/cache.c: Likewise. * elf/chroot_canon.c: Likewise. * elf/ldconfig.c: Likewise. * elf/readlib.c: Likewise. * iconv/dummy-repertoire.c: Likewise. * iconv/iconv_charmap.c: Likewise. * iconv/iconv_prog.c: Likewise. * iconv/iconvconfig.c: Likewise. * locale/programs/3level.h: Likewise. * locale/programs/charmap-dir.c: Likewise. * locale/programs/charmap-dir.h: Likewise. * locale/programs/charmap-kw.gperf: Likewise. * locale/programs/charmap.c: Likewise. * locale/programs/charmap.h: Likewise. * locale/programs/config.h: Likewise. * locale/programs/ld-address.c: Likewise. * locale/programs/ld-collate.c: Likewise. * locale/programs/ld-ctype.c: Likewise. * locale/programs/ld-identification.c: Likewise. * locale/programs/ld-measurement.c: Likewise. * locale/programs/ld-messages.c: Likewise. * locale/programs/ld-monetary.c: Likewise. * locale/programs/ld-name.c: Likewise. * locale/programs/ld-numeric.c: Likewise. * locale/programs/ld-paper.c: Likewise. * locale/programs/ld-telephone.c: Likewise. * locale/programs/ld-time.c: Likewise. * locale/programs/linereader.c: Likewise. * locale/programs/linereader.h: Likewise. * locale/programs/locale-spec.c: Likewise. * locale/programs/locale.c: Likewise. * locale/programs/localedef.c: Likewise. * locale/programs/localedef.h: Likewise. * locale/programs/locarchive.c: Likewise. * locale/programs/locfile-kw.gperf: Likewise. * locale/programs/locfile-token.h: Likewise. * locale/programs/locfile.c: Likewise. * locale/programs/locfile.h: Likewise. * locale/programs/repertoire.c: Likewise. * locale/programs/repertoire.h: Likewise. * locale/programs/simple-hash.c: Likewise. * locale/programs/simple-hash.h: Likewise. * locale/programs/xmalloc.c: Likewise. * locale/programs/xstrdup.c: Likewise. * malloc/memusagestat.c: Likewise. * nscd/aicache.c: Likewise. * nscd/cache.c: Likewise. * nscd/connections.c: Likewise. * nscd/dbg_log.c: Likewise. * nscd/gai.c: Likewise. * nscd/getgrgid_r.c: Likewise. * nscd/getgrnam_r.c: Likewise. * nscd/gethstbyad_r.c: Likewise. * nscd/gethstbynm2_r.c: Likewise. * nscd/getpwnam_r.c: Likewise. * nscd/getpwuid_r.c: Likewise. * nscd/grpcache.c: Likewise. * nscd/hstcache.c: Likewise. * nscd/initgrcache.c: Likewise. * nscd/mem.c: Likewise. * nscd/nscd.c: Likewise. * nscd/nscd_conf.c: Likewise. * nscd/pwdcache.c: Likewise. * posix/getconf.c: Likewise. * sysdeps/generic/nscd_setup_thread.c: Likewise. * sysdeps/unix/sysv/linux/nscd_setup_thread.c: Likewise.
2005-12-07 06:49:17 +01:00
/* Copyright (C) 1999-2003, 2005 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.
* catgets/gencat.c: Use GPL, not LGPL. * elf/cache.c: Likewise. * elf/chroot_canon.c: Likewise. * elf/ldconfig.c: Likewise. * elf/readlib.c: Likewise. * iconv/dummy-repertoire.c: Likewise. * iconv/iconv_charmap.c: Likewise. * iconv/iconv_prog.c: Likewise. * iconv/iconvconfig.c: Likewise. * locale/programs/3level.h: Likewise. * locale/programs/charmap-dir.c: Likewise. * locale/programs/charmap-dir.h: Likewise. * locale/programs/charmap-kw.gperf: Likewise. * locale/programs/charmap.c: Likewise. * locale/programs/charmap.h: Likewise. * locale/programs/config.h: Likewise. * locale/programs/ld-address.c: Likewise. * locale/programs/ld-collate.c: Likewise. * locale/programs/ld-ctype.c: Likewise. * locale/programs/ld-identification.c: Likewise. * locale/programs/ld-measurement.c: Likewise. * locale/programs/ld-messages.c: Likewise. * locale/programs/ld-monetary.c: Likewise. * locale/programs/ld-name.c: Likewise. * locale/programs/ld-numeric.c: Likewise. * locale/programs/ld-paper.c: Likewise. * locale/programs/ld-telephone.c: Likewise. * locale/programs/ld-time.c: Likewise. * locale/programs/linereader.c: Likewise. * locale/programs/linereader.h: Likewise. * locale/programs/locale-spec.c: Likewise. * locale/programs/locale.c: Likewise. * locale/programs/localedef.c: Likewise. * locale/programs/localedef.h: Likewise. * locale/programs/locarchive.c: Likewise. * locale/programs/locfile-kw.gperf: Likewise. * locale/programs/locfile-token.h: Likewise. * locale/programs/locfile.c: Likewise. * locale/programs/locfile.h: Likewise. * locale/programs/repertoire.c: Likewise. * locale/programs/repertoire.h: Likewise. * locale/programs/simple-hash.c: Likewise. * locale/programs/simple-hash.h: Likewise. * locale/programs/xmalloc.c: Likewise. * locale/programs/xstrdup.c: Likewise. * malloc/memusagestat.c: Likewise. * nscd/aicache.c: Likewise. * nscd/cache.c: Likewise. * nscd/connections.c: Likewise. * nscd/dbg_log.c: Likewise. * nscd/gai.c: Likewise. * nscd/getgrgid_r.c: Likewise. * nscd/getgrnam_r.c: Likewise. * nscd/gethstbyad_r.c: Likewise. * nscd/gethstbynm2_r.c: Likewise. * nscd/getpwnam_r.c: Likewise. * nscd/getpwuid_r.c: Likewise. * nscd/grpcache.c: Likewise. * nscd/hstcache.c: Likewise. * nscd/initgrcache.c: Likewise. * nscd/mem.c: Likewise. * nscd/nscd.c: Likewise. * nscd/nscd_conf.c: Likewise. * nscd/pwdcache.c: Likewise. * posix/getconf.c: Likewise. * sysdeps/generic/nscd_setup_thread.c: Likewise. * sysdeps/unix/sysv/linux/nscd_setup_thread.c: Likewise.
2005-12-07 06:49:17 +01:00
This program is free software; you can redistribute it and/or modify
* elf/ldconfig.c: Allow GPLv2 or any later version. * elf/readlib.c: Likewise. * elf/chroot_canon.c: Likewise. * elf/cache.c: Likewise. * nscd/mem.c: Likewise. * nscd/getpwuid_r.c: Likewise. * nscd/grpcache.c: Likewise. * nscd/aicache.c: Likewise. * nscd/getsrvbynm_r.c: Likewise. * nscd/nscd.c: Likewise. * nscd/servicescache.c: Likewise. * nscd/getsrvbypt_r.c: Likewise. * nscd/initgrcache.c: Likewise. * nscd/gethstbyad_r.c: Likewise. * nscd/gethstbynm2_r.c: Likewise. * nscd/getgrnam_r.c: Likewise. * nscd/nscd_setup_thread.c: Likewise. * nscd/getpwnam_r.c: Likewise. * nscd/gai.c: Likewise. * nscd/connections.c: Likewise. * nscd/dbg_log.c: Likewise. * nscd/cache.c: Likewise. * nscd/hstcache.c: Likewise. * nscd/nscd_conf.c: Likewise. * nscd/getgrgid_r.c: Likewise. * nscd/pwdcache.c: Likewise. * catgets/gencat.c: Likewise. * locale/programs/linereader.h: Likewise. * locale/programs/locarchive.c: Likewise. * locale/programs/ld-paper.c: Likewise. * locale/programs/locfile-kw.h: Likewise. * locale/programs/ld-address.c: Likewise. * locale/programs/xmalloc.c: Likewise. * locale/programs/ld-time.c: Likewise. * locale/programs/localedef.c: Likewise. * locale/programs/simple-hash.c: Likewise. * locale/programs/xstrdup.c: Likewise. * locale/programs/ld-numeric.c: Likewise. * locale/programs/locfile-kw.gperf: Likewise. * locale/programs/ld-collate.c: Likewise. * locale/programs/charmap-kw.gperf: Likewise. * locale/programs/charmap.h: Likewise. * locale/programs/charmap-kw.h: Likewise. * locale/programs/config.h: Likewise. * locale/programs/locfile.c: Likewise. * locale/programs/ld-ctype.c: Likewise. * locale/programs/charmap.c: Likewise. * locale/programs/ld-messages.c: Likewise. * locale/programs/repertoire.h: Likewise. * locale/programs/locale.c: Likewise. * locale/programs/ld-name.c: Likewise. * locale/programs/linereader.c: Likewise. * locale/programs/locfile.h: Likewise. * locale/programs/3level.h: Likewise. * locale/programs/ld-monetary.c: Likewise. * locale/programs/ld-measurement.c: Likewise. * locale/programs/charmap-dir.c: Likewise. * locale/programs/ld-identification.c: Likewise. * locale/programs/localedef.h: Likewise. * locale/programs/charmap-dir.h: Likewise. * locale/programs/repertoire.c: Likewise. * locale/programs/simple-hash.h: Likewise. * locale/programs/ld-telephone.c: Likewise. * locale/programs/locale-spec.c: Likewise. * locale/programs/locfile-token.h: Likewise. * posix/getconf.c: Likewise. * iconv/dummy-repertoire.c: Likewise. * iconv/iconv_charmap.c: Likewise. * iconv/iconvconfig.c: Likewise. * iconv/iconv_prog.c: Likewise. * malloc/memusagestat.c: Likewise. * sysdeps/unix/sysv/linux/nscd_setup_thread.c: Likewise.
2007-07-16 02:56:07 +02:00
it under the terms of the GNU General Public License as published
by the Free Software Foundation; version 2 of the License, or
(at your option) any later version.
* catgets/gencat.c: Use GPL, not LGPL. * elf/cache.c: Likewise. * elf/chroot_canon.c: Likewise. * elf/ldconfig.c: Likewise. * elf/readlib.c: Likewise. * iconv/dummy-repertoire.c: Likewise. * iconv/iconv_charmap.c: Likewise. * iconv/iconv_prog.c: Likewise. * iconv/iconvconfig.c: Likewise. * locale/programs/3level.h: Likewise. * locale/programs/charmap-dir.c: Likewise. * locale/programs/charmap-dir.h: Likewise. * locale/programs/charmap-kw.gperf: Likewise. * locale/programs/charmap.c: Likewise. * locale/programs/charmap.h: Likewise. * locale/programs/config.h: Likewise. * locale/programs/ld-address.c: Likewise. * locale/programs/ld-collate.c: Likewise. * locale/programs/ld-ctype.c: Likewise. * locale/programs/ld-identification.c: Likewise. * locale/programs/ld-measurement.c: Likewise. * locale/programs/ld-messages.c: Likewise. * locale/programs/ld-monetary.c: Likewise. * locale/programs/ld-name.c: Likewise. * locale/programs/ld-numeric.c: Likewise. * locale/programs/ld-paper.c: Likewise. * locale/programs/ld-telephone.c: Likewise. * locale/programs/ld-time.c: Likewise. * locale/programs/linereader.c: Likewise. * locale/programs/linereader.h: Likewise. * locale/programs/locale-spec.c: Likewise. * locale/programs/locale.c: Likewise. * locale/programs/localedef.c: Likewise. * locale/programs/localedef.h: Likewise. * locale/programs/locarchive.c: Likewise. * locale/programs/locfile-kw.gperf: Likewise. * locale/programs/locfile-token.h: Likewise. * locale/programs/locfile.c: Likewise. * locale/programs/locfile.h: Likewise. * locale/programs/repertoire.c: Likewise. * locale/programs/repertoire.h: Likewise. * locale/programs/simple-hash.c: Likewise. * locale/programs/simple-hash.h: Likewise. * locale/programs/xmalloc.c: Likewise. * locale/programs/xstrdup.c: Likewise. * malloc/memusagestat.c: Likewise. * nscd/aicache.c: Likewise. * nscd/cache.c: Likewise. * nscd/connections.c: Likewise. * nscd/dbg_log.c: Likewise. * nscd/gai.c: Likewise. * nscd/getgrgid_r.c: Likewise. * nscd/getgrnam_r.c: Likewise. * nscd/gethstbyad_r.c: Likewise. * nscd/gethstbynm2_r.c: Likewise. * nscd/getpwnam_r.c: Likewise. * nscd/getpwuid_r.c: Likewise. * nscd/grpcache.c: Likewise. * nscd/hstcache.c: Likewise. * nscd/initgrcache.c: Likewise. * nscd/mem.c: Likewise. * nscd/nscd.c: Likewise. * nscd/nscd_conf.c: Likewise. * nscd/pwdcache.c: Likewise. * posix/getconf.c: Likewise. * sysdeps/generic/nscd_setup_thread.c: Likewise. * sysdeps/unix/sysv/linux/nscd_setup_thread.c: Likewise.
2005-12-07 06:49:17 +01:00
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
* catgets/gencat.c: Use GPL, not LGPL. * elf/cache.c: Likewise. * elf/chroot_canon.c: Likewise. * elf/ldconfig.c: Likewise. * elf/readlib.c: Likewise. * iconv/dummy-repertoire.c: Likewise. * iconv/iconv_charmap.c: Likewise. * iconv/iconv_prog.c: Likewise. * iconv/iconvconfig.c: Likewise. * locale/programs/3level.h: Likewise. * locale/programs/charmap-dir.c: Likewise. * locale/programs/charmap-dir.h: Likewise. * locale/programs/charmap-kw.gperf: Likewise. * locale/programs/charmap.c: Likewise. * locale/programs/charmap.h: Likewise. * locale/programs/config.h: Likewise. * locale/programs/ld-address.c: Likewise. * locale/programs/ld-collate.c: Likewise. * locale/programs/ld-ctype.c: Likewise. * locale/programs/ld-identification.c: Likewise. * locale/programs/ld-measurement.c: Likewise. * locale/programs/ld-messages.c: Likewise. * locale/programs/ld-monetary.c: Likewise. * locale/programs/ld-name.c: Likewise. * locale/programs/ld-numeric.c: Likewise. * locale/programs/ld-paper.c: Likewise. * locale/programs/ld-telephone.c: Likewise. * locale/programs/ld-time.c: Likewise. * locale/programs/linereader.c: Likewise. * locale/programs/linereader.h: Likewise. * locale/programs/locale-spec.c: Likewise. * locale/programs/locale.c: Likewise. * locale/programs/localedef.c: Likewise. * locale/programs/localedef.h: Likewise. * locale/programs/locarchive.c: Likewise. * locale/programs/locfile-kw.gperf: Likewise. * locale/programs/locfile-token.h: Likewise. * locale/programs/locfile.c: Likewise. * locale/programs/locfile.h: Likewise. * locale/programs/repertoire.c: Likewise. * locale/programs/repertoire.h: Likewise. * locale/programs/simple-hash.c: Likewise. * locale/programs/simple-hash.h: Likewise. * locale/programs/xmalloc.c: Likewise. * locale/programs/xstrdup.c: Likewise. * malloc/memusagestat.c: Likewise. * nscd/aicache.c: Likewise. * nscd/cache.c: Likewise. * nscd/connections.c: Likewise. * nscd/dbg_log.c: Likewise. * nscd/gai.c: Likewise. * nscd/getgrgid_r.c: Likewise. * nscd/getgrnam_r.c: Likewise. * nscd/gethstbyad_r.c: Likewise. * nscd/gethstbynm2_r.c: Likewise. * nscd/getpwnam_r.c: Likewise. * nscd/getpwuid_r.c: Likewise. * nscd/grpcache.c: Likewise. * nscd/hstcache.c: Likewise. * nscd/initgrcache.c: Likewise. * nscd/mem.c: Likewise. * nscd/nscd.c: Likewise. * nscd/nscd_conf.c: Likewise. * nscd/pwdcache.c: Likewise. * posix/getconf.c: Likewise. * sysdeps/generic/nscd_setup_thread.c: Likewise. * sysdeps/unix/sysv/linux/nscd_setup_thread.c: Likewise.
2005-12-07 06:49:17 +01:00
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
* catgets/gencat.c: Use GPL, not LGPL. * elf/cache.c: Likewise. * elf/chroot_canon.c: Likewise. * elf/ldconfig.c: Likewise. * elf/readlib.c: Likewise. * iconv/dummy-repertoire.c: Likewise. * iconv/iconv_charmap.c: Likewise. * iconv/iconv_prog.c: Likewise. * iconv/iconvconfig.c: Likewise. * locale/programs/3level.h: Likewise. * locale/programs/charmap-dir.c: Likewise. * locale/programs/charmap-dir.h: Likewise. * locale/programs/charmap-kw.gperf: Likewise. * locale/programs/charmap.c: Likewise. * locale/programs/charmap.h: Likewise. * locale/programs/config.h: Likewise. * locale/programs/ld-address.c: Likewise. * locale/programs/ld-collate.c: Likewise. * locale/programs/ld-ctype.c: Likewise. * locale/programs/ld-identification.c: Likewise. * locale/programs/ld-measurement.c: Likewise. * locale/programs/ld-messages.c: Likewise. * locale/programs/ld-monetary.c: Likewise. * locale/programs/ld-name.c: Likewise. * locale/programs/ld-numeric.c: Likewise. * locale/programs/ld-paper.c: Likewise. * locale/programs/ld-telephone.c: Likewise. * locale/programs/ld-time.c: Likewise. * locale/programs/linereader.c: Likewise. * locale/programs/linereader.h: Likewise. * locale/programs/locale-spec.c: Likewise. * locale/programs/locale.c: Likewise. * locale/programs/localedef.c: Likewise. * locale/programs/localedef.h: Likewise. * locale/programs/locarchive.c: Likewise. * locale/programs/locfile-kw.gperf: Likewise. * locale/programs/locfile-token.h: Likewise. * locale/programs/locfile.c: Likewise. * locale/programs/locfile.h: Likewise. * locale/programs/repertoire.c: Likewise. * locale/programs/repertoire.h: Likewise. * locale/programs/simple-hash.c: Likewise. * locale/programs/simple-hash.h: Likewise. * locale/programs/xmalloc.c: Likewise. * locale/programs/xstrdup.c: Likewise. * malloc/memusagestat.c: Likewise. * nscd/aicache.c: Likewise. * nscd/cache.c: Likewise. * nscd/connections.c: Likewise. * nscd/dbg_log.c: Likewise. * nscd/gai.c: Likewise. * nscd/getgrgid_r.c: Likewise. * nscd/getgrnam_r.c: Likewise. * nscd/gethstbyad_r.c: Likewise. * nscd/gethstbynm2_r.c: Likewise. * nscd/getpwnam_r.c: Likewise. * nscd/getpwuid_r.c: Likewise. * nscd/grpcache.c: Likewise. * nscd/hstcache.c: Likewise. * nscd/initgrcache.c: Likewise. * nscd/mem.c: Likewise. * nscd/nscd.c: Likewise. * nscd/nscd_conf.c: Likewise. * nscd/pwdcache.c: Likewise. * posix/getconf.c: Likewise. * sysdeps/generic/nscd_setup_thread.c: Likewise. * sysdeps/unix/sysv/linux/nscd_setup_thread.c: Likewise.
2005-12-07 06:49:17 +01:00
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* The code in this file and in readelflib is a heavily simplified
version of the readelf program that's part of the current binutils
development version. Besides the simplification, it has also been
modified to read some other file formats. */
#include <a.out.h>
#include <elf.h>
#include <error.h>
#include <libintl.h>
#include <link.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <gnu/lib-names.h>
#include <ldconfig.h>
#define Elf32_CLASS ELFCLASS32
#define Elf64_CLASS ELFCLASS64
struct known_names
{
const char *soname;
int flag;
};
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.
2001-03-16 08:40:05 +01:00
static struct known_names interpreters[] =
{
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.
2001-03-16 08:40:05 +01:00
{ "/lib/" LD_SO, FLAG_ELF_LIBC6 },
#ifdef SYSDEP_KNOWN_INTERPRETER_NAMES
SYSDEP_KNOWN_INTERPRETER_NAMES
#endif
};
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.
2001-03-16 08:40:05 +01:00
static struct known_names known_libs[] =
{
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.
2001-03-16 08:40:05 +01:00
{ LIBC_SO, FLAG_ELF_LIBC6 },
{ LIBM_SO, FLAG_ELF_LIBC6 },
#ifdef SYSDEP_KNOWN_LIBRARY_NAMES
SYSDEP_KNOWN_LIBRARY_NAMES
#endif
};
/* Returns 0 if everything is ok, != 0 in case of error. */
int
process_file (const char *real_file_name, const char *file_name,
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.
2001-03-16 08:40:05 +01:00
const char *lib, int *flag, unsigned int *osversion,
char **soname, int is_link)
{
FILE *file;
struct stat64 statbuf;
void *file_contents;
int ret;
ElfW(Ehdr) *elf_header;
struct exec *aout_header;
ret = 0;
*flag = FLAG_ANY;
*soname = NULL;
file = fopen (real_file_name, "rb");
if (file == NULL)
{
/* No error for stale symlink. */
if (is_link && strstr (file_name, ".so") != NULL)
return 1;
error (0, 0, _("Input file %s not found.\n"), file_name);
return 1;
}
if (fstat64 (fileno (file), &statbuf) < 0)
{
error (0, 0, _("Cannot fstat file %s.\n"), file_name);
fclose (file);
return 1;
}
/* Check that the file is large enough so that we can access the
information. We're only checking the size of the headers here. */
Update. 2002-08-24 Ulrich Drepper <drepper@redhat.com> * locale/programs/charmap.c (charmap_new_char): Don't use ULONG_MAX as maximum UCS4 value. * sysdeps/unix/sysv/linux/ia64/sys/user.h: New file. * sysdeps/generic/strtol.c: We don't need the isascii test in glibc. * malloc/hooks.c (public_sET_STATe): use size_t as type for i. * malloc/malloc.c (mALLINFo): Likewise. * libio/wstrops.c (_IO_wstr_pbackfail): Use WEOF in comparison. * libio/wfileops.c (_IO_wfile_overflow): Use EOF not WEOF when examining result of _IO_do_flush call. * stdio-common/vfprintf.c (vfprintf): Use correct type in va_arg. Use prec not spec when sizing buffers. * catgets/open_catalog.c (__open_catalog): Add casts to avoid warnings. * locale/loadarchive.c (_nl_load_locale_from_archive): Likewise. * locale/loadlocale.c (_nl_intern_locale_data): Likewise. * stdio-common/vfscanf.c (inchar): Likewise. * misc/efgcvt_r.c (fcvt_r): Likewise. * elf/dl-misc.c (_dl_debug_vdprintf): Likewise. * elf/readlib.c (process_file): Likewise. * elf/sprof.c (load_profdata): Likewise. * sysdeps/ia64/hp-timing.h (HP_TIMING_PRINT): Likewise. * locale/programs/linereader.c (get_toplvl_escape): Likewise. * locale/programs/charmap.c (charmap_read): Likewise. * libio/fileops.c: Likewise. * libio/fmemopen.c: Likewise. * stdlib/strtod.c: Likewise. * elf/dl-load.c: Likewise. * iconv/iconvconfig.c: Likewise. * iconv/iconv_prog.c (process_block): Likewise. * sysdeps/unix/sysv/linux/ia64/Makefile: Define _ASM_IA64_CURRENT_H macro to calm down the compiler. * iconv/gconv_cache.c (__gconv_load_cache): Add cast to avoid warning. * sysdeps/ia64/elf/initfini.c: Don't use newlines embedded in string. * sysdeps/unix/sysv/linux/i386/sysdep.S: Update comment regarding placement of errno definition. * sysdeps/unix/sysv/linux/m68k/sysdep.S: Likewise. * sysdeps/unix/sysv/linux/mips/sysdep.S: Likewise. * sysdeps/unix/sysv/linux/x86_64/sysdep.S: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/sysdep.S: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep.S: Likewise. * resolv/nss_dns/dns-host.c (MAXPACKET): Increase minimum value from 1024 to 65536, to avoid buffer overrun. 2002-08-16 Paul Eggert <eggert@twinsun.com> * resolv/gethnamaddr.c (MAXPACKET): Increase minimum value from 1024 to 65536, to avoid buffer overrun. * resolv/res_query.c (MAXPACKET): Likewise. architectures.
2002-08-25 06:51:08 +02:00
if ((size_t) statbuf.st_size < sizeof (struct exec)
|| (size_t) statbuf.st_size < sizeof (ElfW(Ehdr)))
{
if (statbuf.st_size == 0)
error (0, 0, _("File %s is empty, not checked."), file_name);
else
{
char buf[SELFMAG];
size_t n = MIN (statbuf.st_size, SELFMAG);
if (fread (buf, n, 1, file) == 1 && memcmp (buf, ELFMAG, n) == 0)
error (0, 0, _("File %s is too small, not checked."), file_name);
}
fclose (file);
return 1;
}
file_contents = mmap (0, statbuf.st_size, PROT_READ, MAP_SHARED,
fileno (file), 0);
if (file_contents == MAP_FAILED)
{
error (0, 0, _("Cannot mmap file %s.\n"), file_name);
fclose (file);
return 1;
}
/* First check if this is an aout file. */
aout_header = (struct exec *) file_contents;
if (N_MAGIC (*aout_header) == ZMAGIC
#ifdef QMAGIC /* Linuxism. */
|| N_MAGIC (*aout_header) == QMAGIC
#endif
)
{
/* Aout files don't have a soname, just return the name
including the major number. */
char *copy, *major, *dot;
copy = xstrdup (lib);
major = strstr (copy, ".so.");
if (major)
{
dot = strstr (major + 4, ".");
if (dot)
*dot = '\0';
}
*soname = copy;
*flag = FLAG_LIBC4;
goto done;
}
elf_header = (ElfW(Ehdr) *) file_contents;
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.
2001-03-16 08:40:05 +01:00
if (memcmp (elf_header->e_ident, ELFMAG, SELFMAG) != 0)
{
/* The file is neither ELF nor aout. Check if it's a linker
script, like libc.so - otherwise complain. Only search the
beginning of the file. */
size_t len = MIN (statbuf.st_size, 512);
if (memmem (file_contents, len, "GROUP", 5) == NULL
&& memmem (file_contents, len, "GNU ld script", 13) == NULL)
error (0, 0, _("%s is not an ELF file - it has the wrong magic bytes at the start.\n"),
file_name);
ret = 1;
}
/* Libraries have to be shared object files. */
else if (elf_header->e_type != ET_DYN)
ret = 1;
else if (process_elf_file (file_name, lib, flag, osversion, soname,
file_contents, statbuf.st_size))
ret = 1;
done:
/* Clean up allocated memory and resources. */
munmap (file_contents, statbuf.st_size);
fclose (file);
return ret;
}
/* Get architecture specific version of process_elf_file. */
#include <readelflib.c>