2021-01-02 19:32:25 +00:00
|
|
|
/* Copyright (C) 1999-2021 Free Software Foundation, Inc.
|
1999-12-04 08:00:00 +00:00
|
|
|
This file is part of the GNU C Library.
|
|
|
|
Contributed by Andreas Jaeger <aj@suse.de>, 1999.
|
|
|
|
|
2005-12-07 05:49:17 +00:00
|
|
|
This program is free software; you can redistribute it and/or modify
|
2007-07-16 00:56:07 +00: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.
|
1999-12-04 08:00:00 +00:00
|
|
|
|
2005-12-07 05:49:17 +00:00
|
|
|
This program is distributed in the hope that it will be useful,
|
1999-12-04 08:00:00 +00:00
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2005-12-07 05:49:17 +00:00
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
1999-12-04 08:00:00 +00:00
|
|
|
|
2005-12-07 05:49:17 +00:00
|
|
|
You should have received a copy of the GNU General Public License
|
Prefer https to http for gnu.org and fsf.org URLs
Also, change sources.redhat.com to sourceware.org.
This patch was automatically generated by running the following shell
script, which uses GNU sed, and which avoids modifying files imported
from upstream:
sed -ri '
s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g
s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g
' \
$(find $(git ls-files) -prune -type f \
! -name '*.po' \
! -name 'ChangeLog*' \
! -path COPYING ! -path COPYING.LIB \
! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \
! -path manual/texinfo.tex ! -path scripts/config.guess \
! -path scripts/config.sub ! -path scripts/install-sh \
! -path scripts/mkinstalldirs ! -path scripts/move-if-change \
! -path INSTALL ! -path locale/programs/charmap-kw.h \
! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \
! '(' -name configure \
-execdir test -f configure.ac -o -f configure.in ';' ')' \
! '(' -name preconfigure \
-execdir test -f preconfigure.ac ';' ')' \
-print)
and then by running 'make dist-prepare' to regenerate files built
from the altered files, and then executing the following to cleanup:
chmod a+x sysdeps/unix/sysv/linux/riscv/configure
# Omit irrelevant whitespace and comment-only changes,
# perhaps from a slightly-different Autoconf version.
git checkout -f \
sysdeps/csky/configure \
sysdeps/hppa/configure \
sysdeps/riscv/configure \
sysdeps/unix/sysv/linux/csky/configure
# Omit changes that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines
git checkout -f \
sysdeps/powerpc/powerpc64/ppc-mcount.S \
sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
# Omit change that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline
git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
2019-09-07 05:40:42 +00:00
|
|
|
along with this program; if not, see <https://www.gnu.org/licenses/>. */
|
1999-12-04 08:00:00 +00:00
|
|
|
|
2020-12-04 08:13:43 +00:00
|
|
|
#include <assert.h>
|
1999-12-04 08:00:00 +00:00
|
|
|
#include <errno.h>
|
|
|
|
#include <error.h>
|
|
|
|
#include <dirent.h>
|
2001-02-06 05:48:26 +00:00
|
|
|
#include <inttypes.h>
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
#include <libgen.h>
|
1999-12-04 08:00:00 +00:00
|
|
|
#include <libintl.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <unistd.h>
|
2013-05-01 15:46:34 +00:00
|
|
|
#include <stdint.h>
|
1999-12-04 08:00:00 +00:00
|
|
|
#include <sys/fcntl.h>
|
|
|
|
#include <sys/mman.h>
|
2020-12-10 14:47:26 +00:00
|
|
|
#include <sys/param.h>
|
1999-12-04 08:00:00 +00:00
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
2005-12-21 22:16:34 +00:00
|
|
|
#include <ldconfig.h>
|
|
|
|
#include <dl-cache.h>
|
2020-12-04 08:13:43 +00:00
|
|
|
#include <version.h>
|
2020-12-04 08:13:43 +00:00
|
|
|
#include <stringtable.h>
|
|
|
|
|
|
|
|
/* Used to store library names, paths, and other strings. */
|
|
|
|
static struct stringtable strings;
|
1999-12-04 08:00:00 +00:00
|
|
|
|
2020-12-04 08:13:43 +00:00
|
|
|
/* Keeping track of "glibc-hwcaps" subdirectories. During cache
|
|
|
|
construction, a linear search by name is performed to deduplicate
|
|
|
|
entries. */
|
|
|
|
struct glibc_hwcaps_subdirectory
|
|
|
|
{
|
|
|
|
struct glibc_hwcaps_subdirectory *next;
|
|
|
|
|
|
|
|
/* Interned string with the subdirectory name. */
|
|
|
|
struct stringtable_entry *name;
|
|
|
|
|
|
|
|
/* Array index in the cache_extension_tag_glibc_hwcaps section in
|
|
|
|
the stored cached file. This is computed after all the
|
|
|
|
subdirectories have been processed, so that subdirectory names in
|
|
|
|
the extension section can be sorted. */
|
|
|
|
uint32_t section_index;
|
|
|
|
|
|
|
|
/* True if the subdirectory is actually used for anything. */
|
|
|
|
bool used;
|
|
|
|
};
|
|
|
|
|
|
|
|
const char *
|
|
|
|
glibc_hwcaps_subdirectory_name (const struct glibc_hwcaps_subdirectory *dir)
|
|
|
|
{
|
|
|
|
return dir->name->string;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Linked list of known hwcaps subdirecty names. */
|
|
|
|
static struct glibc_hwcaps_subdirectory *hwcaps;
|
|
|
|
|
|
|
|
struct glibc_hwcaps_subdirectory *
|
|
|
|
new_glibc_hwcaps_subdirectory (const char *name)
|
|
|
|
{
|
|
|
|
struct stringtable_entry *name_interned = stringtable_add (&strings, name);
|
|
|
|
for (struct glibc_hwcaps_subdirectory *p = hwcaps; p != NULL; p = p->next)
|
|
|
|
if (p->name == name_interned)
|
|
|
|
return p;
|
|
|
|
struct glibc_hwcaps_subdirectory *p = xmalloc (sizeof (*p));
|
|
|
|
p->next = hwcaps;
|
|
|
|
p->name = name_interned;
|
|
|
|
p->section_index = 0;
|
|
|
|
p->used = false;
|
|
|
|
hwcaps = p;
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Helper for sorting struct glibc_hwcaps_subdirectory elements by
|
|
|
|
name. */
|
|
|
|
static int
|
|
|
|
assign_glibc_hwcaps_indices_compare (const void *l, const void *r)
|
|
|
|
{
|
|
|
|
const struct glibc_hwcaps_subdirectory *left
|
|
|
|
= *(struct glibc_hwcaps_subdirectory **)l;
|
|
|
|
const struct glibc_hwcaps_subdirectory *right
|
|
|
|
= *(struct glibc_hwcaps_subdirectory **)r;
|
|
|
|
return strcmp (glibc_hwcaps_subdirectory_name (left),
|
|
|
|
glibc_hwcaps_subdirectory_name (right));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Count the number of hwcaps subdirectories which are actually
|
|
|
|
used. */
|
|
|
|
static size_t
|
|
|
|
glibc_hwcaps_count (void)
|
|
|
|
{
|
|
|
|
size_t count = 0;
|
|
|
|
for (struct glibc_hwcaps_subdirectory *p = hwcaps; p != NULL; p = p->next)
|
|
|
|
if (p->used)
|
|
|
|
++count;
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Compute the section_index fields for all */
|
|
|
|
static void
|
|
|
|
assign_glibc_hwcaps_indices (void)
|
|
|
|
{
|
|
|
|
/* Convert the linked list into an array, so that we can use qsort.
|
|
|
|
Only copy the subdirectories which are actually used. */
|
|
|
|
size_t count = glibc_hwcaps_count ();
|
|
|
|
struct glibc_hwcaps_subdirectory **array
|
|
|
|
= xmalloc (sizeof (*array) * count);
|
|
|
|
{
|
|
|
|
size_t i = 0;
|
|
|
|
for (struct glibc_hwcaps_subdirectory *p = hwcaps; p != NULL; p = p->next)
|
|
|
|
if (p->used)
|
|
|
|
{
|
|
|
|
array[i] = p;
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
assert (i == count);
|
|
|
|
}
|
|
|
|
|
|
|
|
qsort (array, count, sizeof (*array), assign_glibc_hwcaps_indices_compare);
|
|
|
|
|
|
|
|
/* Assign the array indices. */
|
|
|
|
for (size_t i = 0; i < count; ++i)
|
|
|
|
array[i]->section_index = i;
|
|
|
|
|
|
|
|
free (array);
|
|
|
|
}
|
|
|
|
|
1999-12-04 08:00:00 +00:00
|
|
|
struct cache_entry
|
|
|
|
{
|
2020-12-04 08:13:43 +00:00
|
|
|
struct stringtable_entry *lib; /* Library name. */
|
|
|
|
struct stringtable_entry *path; /* Path to find library. */
|
2000-05-07 21:23:56 +00:00
|
|
|
int flags; /* Flags to indicate kind of library. */
|
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 07:40:05 +00:00
|
|
|
unsigned int osversion; /* Required OS version. */
|
2020-12-05 15:01:58 +00:00
|
|
|
unsigned int isa_level; /* Required ISA level. */
|
2000-11-15 08:42:13 +00:00
|
|
|
uint64_t hwcap; /* Important hardware capabilities. */
|
2000-05-07 21:23:56 +00:00
|
|
|
int bits_hwcap; /* Number of bits set in hwcap. */
|
2020-12-04 08:13:43 +00:00
|
|
|
|
|
|
|
/* glibc-hwcaps subdirectory. If not NULL, hwcap must be zero. */
|
|
|
|
struct glibc_hwcaps_subdirectory *hwcaps;
|
|
|
|
|
2000-05-07 21:23:56 +00:00
|
|
|
struct cache_entry *next; /* Next entry in list. */
|
1999-12-04 08:00:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* List of all cache entries. */
|
|
|
|
static struct cache_entry *entries;
|
|
|
|
|
|
|
|
static const char *flag_descr[] =
|
|
|
|
{ "libc4", "ELF", "libc5", "libc6"};
|
|
|
|
|
|
|
|
/* Print a single entry. */
|
|
|
|
static void
|
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 07:40:05 +00:00
|
|
|
print_entry (const char *lib, int flag, unsigned int osversion,
|
2020-12-04 08:13:43 +00:00
|
|
|
uint64_t hwcap, const char *hwcap_string, const char *key)
|
1999-12-04 08:00:00 +00:00
|
|
|
{
|
|
|
|
printf ("\t%s (", lib);
|
2000-04-04 20:57:44 +00:00
|
|
|
switch (flag & FLAG_TYPE_MASK)
|
1999-12-04 08:00:00 +00:00
|
|
|
{
|
|
|
|
case FLAG_LIBC4:
|
|
|
|
case FLAG_ELF:
|
|
|
|
case FLAG_ELF_LIBC5:
|
|
|
|
case FLAG_ELF_LIBC6:
|
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 07:40:05 +00:00
|
|
|
fputs (flag_descr[flag & FLAG_TYPE_MASK], stdout);
|
1999-12-04 08:00:00 +00:00
|
|
|
break;
|
|
|
|
default:
|
2001-03-19 22:08:34 +00:00
|
|
|
fputs (_("unknown"), stdout);
|
1999-12-04 08:00:00 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
switch (flag & FLAG_REQUIRED_MASK)
|
|
|
|
{
|
|
|
|
case FLAG_SPARC_LIB64:
|
|
|
|
fputs (",64bit", stdout);
|
2002-09-14 09:00:42 +00:00
|
|
|
break;
|
2000-09-29 22:53:14 +00:00
|
|
|
case FLAG_IA64_LIB64:
|
|
|
|
fputs (",IA-64", stdout);
|
2002-04-08 15:21:19 +00:00
|
|
|
break;
|
|
|
|
case FLAG_X8664_LIB64:
|
|
|
|
fputs (",x86-64", stdout);
|
|
|
|
break;
|
2001-03-19 22:08:34 +00:00
|
|
|
case FLAG_S390_LIB64:
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
fputs (",64bit", stdout);
|
2002-09-14 09:00:42 +00:00
|
|
|
break;
|
|
|
|
case FLAG_POWERPC_LIB64:
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
fputs (",64bit", stdout);
|
2002-09-14 09:00:42 +00:00
|
|
|
break;
|
2003-03-14 05:32:50 +00:00
|
|
|
case FLAG_MIPS64_LIBN32:
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
fputs (",N32", stdout);
|
2003-03-14 05:32:50 +00:00
|
|
|
break;
|
|
|
|
case FLAG_MIPS64_LIBN64:
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
fputs (",64bit", stdout);
|
2012-03-16 22:03:37 +00:00
|
|
|
break;
|
|
|
|
case FLAG_X8664_LIBX32:
|
|
|
|
fputs (",x32", stdout);
|
|
|
|
break;
|
2012-11-19 06:12:53 +00:00
|
|
|
case FLAG_ARM_LIBHF:
|
|
|
|
fputs (",hard-float", stdout);
|
|
|
|
break;
|
2012-11-19 06:22:33 +00:00
|
|
|
case FLAG_AARCH64_LIB64:
|
|
|
|
fputs (",AArch64", stdout);
|
|
|
|
break;
|
2013-02-08 17:26:12 +00:00
|
|
|
/* Uses the ARM soft-float ABI. */
|
|
|
|
case FLAG_ARM_LIBSF:
|
|
|
|
fputs (",soft-float", stdout);
|
|
|
|
break;
|
MIPS: IEEE 754-2008 NaN encoding support
It has been a long practice for software using IEEE 754 floating-point
arithmetic run on MIPS processors to use an encoding of Not-a-Number
(NaN) data different to one used by software run on other processors.
And as of IEEE 754-2008 revision [1] this encoding does not follow one
recommended in the standard, as specified in section 6.2.1, where it
is stated that quiet NaNs should have the first bit (d1) of their
significand set to 1 while signalling NaNs should have that bit set to
0, but MIPS software interprets the two bits in the opposite manner.
As from revision 3.50 [2][3] the MIPS Architecture provides for
processors that support the IEEE 754-2008 preferred NaN encoding format.
As the two formats (further referred to as "legacy NaN" and "2008 NaN")
are incompatible to each other, tools have to provide support for the
two formats to help people avoid using incompatible binary modules.
The change is comprised of two functional groups of features, both of
which are required for correct support.
1. Dynamic linker support.
To enforce the NaN encoding requirement in dynamic linking a new ELF
file header flag has been defined. This flag is set for 2008-NaN
shared modules and executables and clear for legacy-NaN ones. The
dynamic linker silently ignores any incompatible modules it
encounters in dependency processing.
To avoid unnecessary processing of incompatible modules in the
presence of a shared module cache, a set of new cache flags has been
defined to mark 2008-NaN modules for the three ABIs supported.
Changes to sysdeps/unix/sysv/linux/mips/readelflib.c have been made
following an earlier code quality suggestion made here:
http://sourceware.org/ml/libc-ports/2009-03/msg00036.html
and are therefore a little bit more extensive than the minimum
required.
Finally a new name has been defined for the dynamic linker so that
2008-NaN and legacy-NaN binaries can coexist on a single system that
supports dual-mode operation and that a legacy dynamic linker that
does not support verifying the 2008-NaN ELF file header flag is not
chosen to interpret a 2008-NaN binary by accident.
2. Floating environment support.
IEEE 754-2008 features are controlled in the Floating-Point Control
and Status (FCSR) register and updates are needed to floating
environment support so that the 2008-NaN flag is set correctly and
the kernel default, inferred from the 2008-NaN ELF file header flag
at the time an executable is loaded, respected.
As the NaN encoding format is a property of GCC code generation that is
both a user-selected GCC configuration default and can be overridden
with GCC options, code that needs to know what NaN encoding standard it
has been configured for checks for the __mips_nan2008 macro that is
defined internally by GCC whenever the 2008-NaN mode has been selected.
This mode is determined at the glibc configuration time and therefore a
few consistency checks have been added to catch cases where compilation
flags have been overridden by the user.
The 2008 NaN set of features relies on kernel support as the in-kernel
floating-point emulator needs to be aware of the NaN encoding used even
on hard-float processors and configure the FPU context according to the
value of the 2008 NaN ELF file header flag of the executable being
started. As at this time work on kernel support is still in progress
and the relevant changes have not made their way yet to linux.org master
repository.
Therefore the minimum version supported has been artificially set to
10.0.0 so that 2008-NaN code is not accidentally run on a Linux kernel
that does not suppport it. It is anticipated that the version is
adjusted later on to the actual initial linux.org kernel version to
support this feature. Legacy NaN encoding support is unaffected, older
kernel versions remain supported.
[1] "IEEE Standard for Floating-Point Arithmetic", IEEE Computer
Society, IEEE Std 754-2008, 29 August 2008
[2] "MIPS Architecture For Programmers, Volume I-A: Introduction to the
MIPS32 Architecture", MIPS Technologies, Inc., Document Number:
MD00082, Revision 3.50, September 20, 2012
[3] "MIPS Architecture For Programmers, Volume I-A: Introduction to the
MIPS64 Architecture", MIPS Technologies, Inc., Document Number:
MD00083, Revision 3.50, September 20, 2012
2013-09-18 20:04:27 +00:00
|
|
|
case FLAG_MIPS_LIB32_NAN2008:
|
|
|
|
fputs (",nan2008", stdout);
|
|
|
|
break;
|
|
|
|
case FLAG_MIPS64_LIBN32_NAN2008:
|
|
|
|
fputs (",N32,nan2008", stdout);
|
|
|
|
break;
|
|
|
|
case FLAG_MIPS64_LIBN64_NAN2008:
|
|
|
|
fputs (",64bit,nan2008", stdout);
|
|
|
|
break;
|
2018-01-13 09:59:12 +00:00
|
|
|
case FLAG_RISCV_FLOAT_ABI_SOFT:
|
|
|
|
fputs (",soft-float", stdout);
|
|
|
|
break;
|
|
|
|
case FLAG_RISCV_FLOAT_ABI_DOUBLE:
|
|
|
|
fputs (",double-float", stdout);
|
|
|
|
break;
|
1999-12-04 08:00:00 +00:00
|
|
|
case 0:
|
|
|
|
break;
|
|
|
|
default:
|
2000-05-07 21:23:56 +00:00
|
|
|
printf (",%d", flag & FLAG_REQUIRED_MASK);
|
1999-12-04 08:00:00 +00:00
|
|
|
break;
|
|
|
|
}
|
2020-12-04 08:13:43 +00:00
|
|
|
if (hwcap_string != NULL)
|
|
|
|
printf (", hwcap: \"%s\"", hwcap_string);
|
|
|
|
else if (hwcap != 0)
|
2005-04-07 20:57:41 +00:00
|
|
|
printf (", hwcap: %#.16" PRIx64, hwcap);
|
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 07:40:05 +00:00
|
|
|
if (osversion != 0)
|
|
|
|
{
|
|
|
|
static const char *const abi_tag_os[] =
|
|
|
|
{
|
|
|
|
[0] = "Linux",
|
|
|
|
[1] = "Hurd",
|
|
|
|
[2] = "Solaris",
|
2002-09-20 22:07:20 +00:00
|
|
|
[3] = "FreeBSD",
|
2005-10-17 02:44:01 +00:00
|
|
|
[4] = "kNetBSD",
|
2006-01-04 17:14:58 +00:00
|
|
|
[5] = "Syllable",
|
|
|
|
[6] = N_("Unknown OS")
|
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 07:40:05 +00:00
|
|
|
};
|
2002-09-20 22:07:20 +00:00
|
|
|
#define MAXTAG (sizeof abi_tag_os / sizeof abi_tag_os[0] - 1)
|
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 07:40:05 +00:00
|
|
|
unsigned int os = osversion >> 24;
|
|
|
|
|
2001-03-19 22:08:34 +00:00
|
|
|
printf (_(", OS ABI: %s %d.%d.%d"),
|
2002-09-20 22:07:20 +00:00
|
|
|
_(abi_tag_os[os > MAXTAG ? MAXTAG : os]),
|
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 07:40:05 +00:00
|
|
|
(osversion >> 16) & 0xff,
|
|
|
|
(osversion >> 8) & 0xff,
|
|
|
|
osversion & 0xff);
|
|
|
|
}
|
1999-12-04 08:00:00 +00:00
|
|
|
printf (") => %s\n", key);
|
|
|
|
}
|
|
|
|
|
2020-12-04 08:13:43 +00:00
|
|
|
/* Returns the string with the name of the glibcs-hwcaps subdirectory
|
|
|
|
associated with ENTRY->hwcap. file_base must be the base address
|
|
|
|
for string table indices. */
|
|
|
|
static const char *
|
|
|
|
glibc_hwcaps_string (struct cache_extension_all_loaded *ext,
|
|
|
|
const void *file_base, size_t file_size,
|
|
|
|
struct file_entry_new *entry)
|
|
|
|
{
|
|
|
|
const uint32_t *hwcaps_array
|
|
|
|
= ext->sections[cache_extension_tag_glibc_hwcaps].base;
|
|
|
|
if (dl_cache_hwcap_extension (entry) && hwcaps_array != NULL)
|
|
|
|
{
|
|
|
|
uint32_t index = (uint32_t) entry->hwcap;
|
|
|
|
if (index < ext->sections[cache_extension_tag_glibc_hwcaps].size / 4)
|
|
|
|
{
|
|
|
|
uint32_t string_table_index = hwcaps_array[index];
|
|
|
|
if (string_table_index < file_size)
|
|
|
|
return file_base + string_table_index;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2020-12-04 08:13:43 +00:00
|
|
|
/* Print an error and exit if the new-file cache is internally
|
|
|
|
inconsistent. */
|
|
|
|
static void
|
|
|
|
check_new_cache (struct cache_file_new *cache)
|
|
|
|
{
|
|
|
|
if (! cache_file_new_matches_endian (cache))
|
|
|
|
error (EXIT_FAILURE, 0, _("Cache file has wrong endianness.\n"));
|
|
|
|
}
|
1999-12-04 08:00:00 +00:00
|
|
|
|
2020-12-04 08:13:43 +00:00
|
|
|
/* Print the extension information in *EXT. */
|
2020-12-04 08:13:43 +00:00
|
|
|
static void
|
|
|
|
print_extensions (struct cache_extension_all_loaded *ext)
|
|
|
|
{
|
|
|
|
if (ext->sections[cache_extension_tag_generator].base != NULL)
|
|
|
|
{
|
|
|
|
fputs (_("Cache generated by: "), stdout);
|
|
|
|
fwrite (ext->sections[cache_extension_tag_generator].base, 1,
|
|
|
|
ext->sections[cache_extension_tag_generator].size, stdout);
|
|
|
|
putchar ('\n');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-05-07 21:23:56 +00:00
|
|
|
/* Print the whole cache file, if a file contains the new cache format
|
|
|
|
hidden in the old one, print the contents of the new format. */
|
1999-12-04 08:00:00 +00:00
|
|
|
void
|
|
|
|
print_cache (const char *cache_name)
|
|
|
|
{
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
int fd = open (cache_name, O_RDONLY);
|
1999-12-04 08:00:00 +00:00
|
|
|
if (fd < 0)
|
|
|
|
error (EXIT_FAILURE, errno, _("Can't open cache file %s\n"), cache_name);
|
|
|
|
|
2021-12-29 13:20:46 +00:00
|
|
|
struct stat st;
|
|
|
|
if (fstat (fd, &st) < 0
|
1999-12-04 08:00:00 +00:00
|
|
|
/* No need to map the file if it is empty. */
|
|
|
|
|| st.st_size == 0)
|
|
|
|
{
|
|
|
|
close (fd);
|
|
|
|
return;
|
|
|
|
}
|
2000-04-10 16:22:52 +00:00
|
|
|
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
struct cache_file *cache
|
|
|
|
= mmap (NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
|
1999-12-04 08:00:00 +00:00
|
|
|
if (cache == MAP_FAILED)
|
|
|
|
error (EXIT_FAILURE, errno, _("mmap of cache file failed.\n"));
|
|
|
|
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
size_t cache_size = st.st_size;
|
2000-05-07 21:23:56 +00:00
|
|
|
if (cache_size < sizeof (struct cache_file))
|
|
|
|
error (EXIT_FAILURE, 0, _("File is not a cache file.\n"));
|
|
|
|
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
struct cache_file_new *cache_new = NULL;
|
|
|
|
const char *cache_data;
|
|
|
|
int format = 0;
|
|
|
|
|
2000-05-07 21:23:56 +00:00
|
|
|
if (memcmp (cache->magic, CACHEMAGIC, sizeof CACHEMAGIC - 1))
|
|
|
|
{
|
|
|
|
/* This can only be the new format without the old one. */
|
|
|
|
cache_new = (struct cache_file_new *) cache;
|
|
|
|
|
|
|
|
if (memcmp (cache_new->magic, CACHEMAGIC_NEW, sizeof CACHEMAGIC_NEW - 1)
|
|
|
|
|| memcmp (cache_new->version, CACHE_VERSION,
|
|
|
|
sizeof CACHE_VERSION - 1))
|
|
|
|
error (EXIT_FAILURE, 0, _("File is not a cache file.\n"));
|
2020-12-04 08:13:43 +00:00
|
|
|
check_new_cache (cache_new);
|
2000-05-07 21:23:56 +00:00
|
|
|
format = 1;
|
|
|
|
/* This is where the strings start. */
|
2000-05-17 11:04:21 +00:00
|
|
|
cache_data = (const char *) cache_new;
|
2000-05-07 21:23:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-10-23 07:40:14 +00:00
|
|
|
/* Check for corruption, avoiding overflow. */
|
|
|
|
if ((cache_size - sizeof (struct cache_file)) / sizeof (struct file_entry)
|
|
|
|
< cache->nlibs)
|
|
|
|
error (EXIT_FAILURE, 0, _("File is not a cache file.\n"));
|
|
|
|
|
2000-05-17 11:04:21 +00:00
|
|
|
size_t offset = ALIGN_CACHE (sizeof (struct cache_file)
|
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 07:40:05 +00:00
|
|
|
+ (cache->nlibs
|
|
|
|
* sizeof (struct file_entry)));
|
2000-05-07 21:23:56 +00:00
|
|
|
/* This is where the strings start. */
|
|
|
|
cache_data = (const char *) &cache->libs[cache->nlibs];
|
|
|
|
|
|
|
|
/* Check for a new cache embedded in the old format. */
|
2019-02-25 13:19:19 +00:00
|
|
|
if (cache_size
|
|
|
|
> (offset + sizeof (struct cache_file_new)))
|
2000-05-07 21:23:56 +00:00
|
|
|
{
|
2000-05-17 11:04:21 +00:00
|
|
|
|
|
|
|
cache_new = (struct cache_file_new *) ((void *)cache + offset);
|
1999-12-04 08:00:00 +00:00
|
|
|
|
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 07:40:05 +00:00
|
|
|
if (memcmp (cache_new->magic, CACHEMAGIC_NEW,
|
|
|
|
sizeof CACHEMAGIC_NEW - 1) == 0
|
|
|
|
&& memcmp (cache_new->version, CACHE_VERSION,
|
|
|
|
sizeof CACHE_VERSION - 1) == 0)
|
2000-05-17 11:04:21 +00:00
|
|
|
{
|
2020-12-04 08:13:43 +00:00
|
|
|
check_new_cache (cache_new);
|
2000-05-17 11:04:21 +00:00
|
|
|
cache_data = (const char *) cache_new;
|
|
|
|
format = 1;
|
|
|
|
}
|
2000-05-07 21:23:56 +00:00
|
|
|
}
|
|
|
|
}
|
2000-04-10 16:22:52 +00:00
|
|
|
|
2000-05-07 21:23:56 +00:00
|
|
|
if (format == 0)
|
|
|
|
{
|
|
|
|
printf (_("%d libs found in cache `%s'\n"), cache->nlibs, cache_name);
|
1999-12-04 08:00:00 +00:00
|
|
|
|
2000-05-07 21:23:56 +00:00
|
|
|
/* Print everything. */
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
for (unsigned int i = 0; i < cache->nlibs; i++)
|
2000-05-07 21:23:56 +00:00
|
|
|
print_entry (cache_data + cache->libs[i].key,
|
2020-12-04 08:13:43 +00:00
|
|
|
cache->libs[i].flags, 0, 0, NULL,
|
2000-05-07 21:23:56 +00:00
|
|
|
cache_data + cache->libs[i].value);
|
|
|
|
}
|
|
|
|
else if (format == 1)
|
|
|
|
{
|
2020-12-04 08:13:43 +00:00
|
|
|
struct cache_extension_all_loaded ext;
|
|
|
|
if (!cache_extension_load (cache_new, cache, cache_size, &ext))
|
|
|
|
error (EXIT_FAILURE, 0,
|
|
|
|
_("Malformed extension data in cache file %s\n"), cache_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 07:40:05 +00:00
|
|
|
printf (_("%d libs found in cache `%s'\n"),
|
|
|
|
cache_new->nlibs, cache_name);
|
2000-05-07 21:23:56 +00:00
|
|
|
|
|
|
|
/* Print everything. */
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
for (unsigned int i = 0; i < cache_new->nlibs; i++)
|
2020-12-04 08:13:43 +00:00
|
|
|
{
|
|
|
|
const char *hwcaps_string
|
|
|
|
= glibc_hwcaps_string (&ext, cache, cache_size,
|
|
|
|
&cache_new->libs[i]);
|
|
|
|
print_entry (cache_data + cache_new->libs[i].key,
|
|
|
|
cache_new->libs[i].flags,
|
|
|
|
cache_new->libs[i].osversion,
|
|
|
|
cache_new->libs[i].hwcap, hwcaps_string,
|
|
|
|
cache_data + cache_new->libs[i].value);
|
|
|
|
}
|
2020-12-04 08:13:43 +00:00
|
|
|
print_extensions (&ext);
|
2000-05-07 21:23:56 +00:00
|
|
|
}
|
1999-12-04 08:00:00 +00:00
|
|
|
/* Cleanup. */
|
|
|
|
munmap (cache, cache_size);
|
|
|
|
close (fd);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Initialize cache data structures. */
|
|
|
|
void
|
|
|
|
init_cache (void)
|
|
|
|
{
|
|
|
|
entries = NULL;
|
|
|
|
}
|
|
|
|
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
static int
|
|
|
|
compare (const struct cache_entry *e1, const struct cache_entry *e2)
|
1999-12-04 08:00:00 +00:00
|
|
|
{
|
|
|
|
/* We need to swap entries here to get the correct sort order. */
|
2020-12-04 08:13:43 +00:00
|
|
|
int res = _dl_cache_libcmp (e2->lib->string, e1->lib->string);
|
1999-12-04 08:00:00 +00:00
|
|
|
if (res == 0)
|
|
|
|
{
|
|
|
|
if (e1->flags < e2->flags)
|
|
|
|
return 1;
|
|
|
|
else if (e1->flags > e2->flags)
|
|
|
|
return -1;
|
2020-12-04 08:13:43 +00:00
|
|
|
/* Keep the glibc-hwcaps extension entries before the regular
|
|
|
|
entries, and sort them by their names. search_cache in
|
|
|
|
dl-cache.c stops searching once the first non-extension entry
|
|
|
|
is found, so the extension entries need to come first. */
|
|
|
|
else if (e1->hwcaps != NULL && e2->hwcaps == NULL)
|
|
|
|
return -1;
|
|
|
|
else if (e1->hwcaps == NULL && e2->hwcaps != NULL)
|
|
|
|
return 1;
|
|
|
|
else if (e1->hwcaps != NULL && e2->hwcaps != NULL)
|
|
|
|
{
|
|
|
|
res = strcmp (glibc_hwcaps_subdirectory_name (e1->hwcaps),
|
|
|
|
glibc_hwcaps_subdirectory_name (e2->hwcaps));
|
|
|
|
if (res != 0)
|
|
|
|
return res;
|
|
|
|
}
|
2000-05-07 21:23:56 +00:00
|
|
|
/* Sort by most specific hwcap. */
|
2020-12-04 08:13:43 +00:00
|
|
|
if (e2->bits_hwcap > e1->bits_hwcap)
|
2000-05-07 21:23:56 +00:00
|
|
|
return 1;
|
|
|
|
else if (e2->bits_hwcap < e1->bits_hwcap)
|
|
|
|
return -1;
|
|
|
|
else if (e2->hwcap > e1->hwcap)
|
|
|
|
return 1;
|
|
|
|
else if (e2->hwcap < e1->hwcap)
|
|
|
|
return -1;
|
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 07:40:05 +00:00
|
|
|
if (e2->osversion > e1->osversion)
|
|
|
|
return 1;
|
|
|
|
if (e2->osversion < e1->osversion)
|
|
|
|
return -1;
|
1999-12-04 08:00:00 +00:00
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2020-12-04 08:13:43 +00:00
|
|
|
/* Size of the cache extension directory. All tags are assumed to be
|
|
|
|
present. */
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
cache_extension_size = (offsetof (struct cache_extension, sections)
|
|
|
|
+ (cache_extension_count
|
|
|
|
* sizeof (struct cache_extension_section)))
|
|
|
|
};
|
|
|
|
|
2020-12-04 08:13:43 +00:00
|
|
|
/* Write the cache extensions to FD. The string table is shifted by
|
|
|
|
STRING_TABLE_OFFSET. The extension directory is assumed to be
|
|
|
|
located at CACHE_EXTENSION_OFFSET. assign_glibc_hwcaps_indices
|
|
|
|
must have been called. */
|
2020-12-04 08:13:43 +00:00
|
|
|
static void
|
2020-12-04 08:13:43 +00:00
|
|
|
write_extensions (int fd, uint32_t str_offset,
|
|
|
|
uint32_t cache_extension_offset)
|
2020-12-04 08:13:43 +00:00
|
|
|
{
|
|
|
|
assert ((cache_extension_offset % 4) == 0);
|
|
|
|
|
2020-12-04 08:13:43 +00:00
|
|
|
/* The length and contents of the glibc-hwcaps section. */
|
|
|
|
uint32_t hwcaps_count = glibc_hwcaps_count ();
|
|
|
|
uint32_t hwcaps_offset = cache_extension_offset + cache_extension_size;
|
|
|
|
uint32_t hwcaps_size = hwcaps_count * sizeof (uint32_t);
|
|
|
|
uint32_t *hwcaps_array = xmalloc (hwcaps_size);
|
|
|
|
for (struct glibc_hwcaps_subdirectory *p = hwcaps; p != NULL; p = p->next)
|
|
|
|
if (p->used)
|
|
|
|
hwcaps_array[p->section_index] = str_offset + p->name->offset;
|
|
|
|
|
|
|
|
/* This is the offset of the generator string. */
|
|
|
|
uint32_t generator_offset = hwcaps_offset;
|
|
|
|
if (hwcaps_count == 0)
|
|
|
|
/* There is no section for the hwcaps subdirectories. */
|
|
|
|
generator_offset -= sizeof (struct cache_extension_section);
|
|
|
|
else
|
|
|
|
/* The string table indices for the hwcaps subdirectories shift
|
|
|
|
the generator string backwards. */
|
|
|
|
generator_offset += hwcaps_size;
|
|
|
|
|
2020-12-04 08:13:43 +00:00
|
|
|
struct cache_extension *ext = xmalloc (cache_extension_size);
|
|
|
|
ext->magic = cache_extension_magic;
|
|
|
|
|
2020-12-04 08:13:43 +00:00
|
|
|
/* Extension index current being filled. */
|
|
|
|
size_t xid = 0;
|
2020-12-04 08:13:43 +00:00
|
|
|
|
|
|
|
const char *generator
|
|
|
|
= "ldconfig " PKGVERSION RELEASE " release version " VERSION;
|
2020-12-04 08:13:43 +00:00
|
|
|
ext->sections[xid].tag = cache_extension_tag_generator;
|
|
|
|
ext->sections[xid].flags = 0;
|
|
|
|
ext->sections[xid].offset = generator_offset;
|
|
|
|
ext->sections[xid].size = strlen (generator);
|
|
|
|
|
|
|
|
if (hwcaps_count > 0)
|
|
|
|
{
|
|
|
|
++xid;
|
|
|
|
ext->sections[xid].tag = cache_extension_tag_glibc_hwcaps;
|
|
|
|
ext->sections[xid].flags = 0;
|
|
|
|
ext->sections[xid].offset = hwcaps_offset;
|
|
|
|
ext->sections[xid].size = hwcaps_size;
|
|
|
|
}
|
2020-12-04 08:13:43 +00:00
|
|
|
|
2020-12-04 08:13:43 +00:00
|
|
|
++xid;
|
|
|
|
ext->count = xid;
|
|
|
|
assert (xid <= cache_extension_count);
|
|
|
|
|
|
|
|
size_t ext_size = (offsetof (struct cache_extension, sections)
|
|
|
|
+ xid * sizeof (struct cache_extension_section));
|
|
|
|
if (write (fd, ext, ext_size) != ext_size
|
|
|
|
|| write (fd, hwcaps_array, hwcaps_size) != hwcaps_size
|
2020-12-04 08:13:43 +00:00
|
|
|
|| write (fd, generator, strlen (generator)) != strlen (generator))
|
|
|
|
error (EXIT_FAILURE, errno, _("Writing of cache extension data failed"));
|
|
|
|
|
2021-05-18 03:38:41 +00:00
|
|
|
free (hwcaps_array);
|
2020-12-04 08:13:43 +00:00
|
|
|
free (ext);
|
|
|
|
}
|
|
|
|
|
2020-12-05 15:01:58 +00:00
|
|
|
/* Compute the hwcap value from ENTRY. */
|
|
|
|
static inline uint64_t
|
|
|
|
compute_hwcap_value (struct cache_entry *entry)
|
|
|
|
{
|
|
|
|
if (entry->isa_level > DL_CACHE_HWCAP_ISA_LEVEL_MASK)
|
|
|
|
error (EXIT_FAILURE, 0, _("%s: ISA level is too high (%d > %d)"),
|
|
|
|
entry->path->string, entry->isa_level,
|
|
|
|
DL_CACHE_HWCAP_ISA_LEVEL_MASK);
|
|
|
|
return (DL_CACHE_HWCAP_EXTENSION
|
|
|
|
| (((uint64_t) entry->isa_level) << 32)
|
|
|
|
| entry->hwcaps->section_index);
|
|
|
|
}
|
|
|
|
|
1999-12-04 08:00:00 +00:00
|
|
|
/* Save the contents of the cache. */
|
|
|
|
void
|
|
|
|
save_cache (const char *cache_name)
|
|
|
|
{
|
|
|
|
/* The cache entries are sorted already, save them in this order. */
|
|
|
|
|
2020-12-04 08:13:43 +00:00
|
|
|
assign_glibc_hwcaps_indices ();
|
|
|
|
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
struct cache_entry *entry;
|
|
|
|
/* Number of cache entries. */
|
|
|
|
int cache_entry_count = 0;
|
2020-12-04 08:13:43 +00:00
|
|
|
/* The old format doesn't contain hwcap entries and doesn't contain
|
|
|
|
libraries in subdirectories with hwcaps entries. Count therefore
|
|
|
|
also all entries with hwcap == 0. */
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
int cache_entry_old_count = 0;
|
|
|
|
|
1999-12-04 08:00:00 +00:00
|
|
|
for (entry = entries; entry != NULL; entry = entry->next)
|
|
|
|
{
|
|
|
|
++cache_entry_count;
|
2000-05-07 21:23:56 +00:00
|
|
|
if (entry->hwcap == 0)
|
|
|
|
++cache_entry_old_count;
|
1999-12-04 08:00:00 +00:00
|
|
|
}
|
2000-04-10 16:22:52 +00:00
|
|
|
|
2020-12-04 08:13:43 +00:00
|
|
|
struct stringtable_finalized strings_finalized;
|
|
|
|
stringtable_finalize (&strings, &strings_finalized);
|
|
|
|
|
1999-12-04 08:00:00 +00:00
|
|
|
/* Create the on disk cache structure. */
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
struct cache_file *file_entries = NULL;
|
|
|
|
size_t file_entries_size = 0;
|
1999-12-04 08:00:00 +00:00
|
|
|
|
2020-11-26 15:59:44 +00:00
|
|
|
if (opt_format != opt_format_new)
|
2000-05-07 21:23:56 +00:00
|
|
|
{
|
2003-08-25 18:37:54 +00:00
|
|
|
/* struct cache_file_new is 64-bit aligned on some arches while
|
|
|
|
only 32-bit aligned on other arches. Duplicate last old
|
|
|
|
cache entry so that new cache in ld.so.cache can be used by
|
|
|
|
both. */
|
2020-11-26 15:59:44 +00:00
|
|
|
if (opt_format != opt_format_old)
|
2003-08-25 18:37:54 +00:00
|
|
|
cache_entry_old_count = (cache_entry_old_count + 1) & ~1;
|
|
|
|
|
2000-05-07 21:23:56 +00:00
|
|
|
/* And the list of all entries in the old format. */
|
|
|
|
file_entries_size = sizeof (struct cache_file)
|
|
|
|
+ cache_entry_old_count * sizeof (struct file_entry);
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
file_entries = xmalloc (file_entries_size);
|
2000-05-07 21:23:56 +00:00
|
|
|
|
|
|
|
/* Fill in the header. */
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
memset (file_entries, '\0', sizeof (struct cache_file));
|
2000-05-07 21:23:56 +00:00
|
|
|
memcpy (file_entries->magic, CACHEMAGIC, sizeof CACHEMAGIC - 1);
|
1999-12-04 08:00:00 +00:00
|
|
|
|
2000-05-07 21:23:56 +00:00
|
|
|
file_entries->nlibs = cache_entry_old_count;
|
|
|
|
}
|
2000-04-10 16:22:52 +00:00
|
|
|
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
struct cache_file_new *file_entries_new = NULL;
|
|
|
|
size_t file_entries_new_size = 0;
|
|
|
|
|
2020-11-26 15:59:44 +00:00
|
|
|
if (opt_format != opt_format_old)
|
2000-05-07 21:23:56 +00:00
|
|
|
{
|
|
|
|
/* And the list of all entries in the new format. */
|
|
|
|
file_entries_new_size = sizeof (struct cache_file_new)
|
|
|
|
+ cache_entry_count * sizeof (struct file_entry_new);
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
file_entries_new = xmalloc (file_entries_new_size);
|
2000-05-07 21:23:56 +00:00
|
|
|
|
|
|
|
/* Fill in the header. */
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
memset (file_entries_new, '\0', sizeof (struct cache_file_new));
|
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 07:40:05 +00:00
|
|
|
memcpy (file_entries_new->magic, CACHEMAGIC_NEW,
|
|
|
|
sizeof CACHEMAGIC_NEW - 1);
|
|
|
|
memcpy (file_entries_new->version, CACHE_VERSION,
|
|
|
|
sizeof CACHE_VERSION - 1);
|
2000-05-07 21:23:56 +00:00
|
|
|
|
|
|
|
file_entries_new->nlibs = cache_entry_count;
|
2020-12-04 08:13:43 +00:00
|
|
|
file_entries_new->len_strings = strings_finalized.size;
|
2020-12-04 08:13:43 +00:00
|
|
|
file_entries_new->flags = cache_file_new_flags_endian_current;
|
2000-05-07 21:23:56 +00:00
|
|
|
}
|
2000-09-29 22:53:14 +00:00
|
|
|
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
/* Pad for alignment of cache_file_new. */
|
|
|
|
size_t pad = ALIGN_CACHE (file_entries_size) - file_entries_size;
|
2000-09-29 22:53:14 +00:00
|
|
|
|
2000-05-07 21:23:56 +00:00
|
|
|
/* If we have both formats, we hide the new format in the strings
|
|
|
|
table, we have to adjust all string indices for this so that
|
|
|
|
old libc5/glibc 2 dynamic linkers just ignore them. */
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
unsigned int str_offset;
|
2020-11-26 15:59:44 +00:00
|
|
|
if (opt_format != opt_format_old)
|
2000-05-07 21:23:56 +00:00
|
|
|
str_offset = file_entries_new_size;
|
|
|
|
else
|
|
|
|
str_offset = 0;
|
1999-12-04 08:00:00 +00:00
|
|
|
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
/* An array for all strings. */
|
|
|
|
int idx_old;
|
|
|
|
int idx_new;
|
|
|
|
|
2000-05-07 21:23:56 +00:00
|
|
|
for (idx_old = 0, idx_new = 0, entry = entries; entry != NULL;
|
|
|
|
entry = entry->next, ++idx_new)
|
1999-12-04 08:00:00 +00:00
|
|
|
{
|
2020-11-26 15:59:44 +00:00
|
|
|
if (opt_format != opt_format_new && entry->hwcap == 0)
|
2000-05-07 21:23:56 +00:00
|
|
|
{
|
|
|
|
file_entries->libs[idx_old].flags = entry->flags;
|
|
|
|
/* XXX: Actually we can optimize here and remove duplicates. */
|
2000-05-17 11:04:21 +00:00
|
|
|
file_entries->libs[idx_old].key = str_offset + pad;
|
2020-12-04 08:13:43 +00:00
|
|
|
file_entries->libs[idx_new].key = str_offset + entry->lib->offset;
|
|
|
|
file_entries->libs[idx_new].value
|
|
|
|
= str_offset + entry->path->offset;
|
2000-05-07 21:23:56 +00:00
|
|
|
}
|
2020-11-26 15:59:44 +00:00
|
|
|
if (opt_format != opt_format_old)
|
2000-05-07 21:23:56 +00:00
|
|
|
{
|
|
|
|
/* We could subtract file_entries_new_size from str_offset -
|
|
|
|
not doing so makes the code easier, the string table
|
2011-04-23 01:34:32 +00:00
|
|
|
always begins at the beginning of the new cache
|
2000-05-07 21:23:56 +00:00
|
|
|
struct. */
|
|
|
|
file_entries_new->libs[idx_new].flags = entry->flags;
|
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 07:40:05 +00:00
|
|
|
file_entries_new->libs[idx_new].osversion = entry->osversion;
|
2020-12-04 08:13:43 +00:00
|
|
|
if (entry->hwcaps == NULL)
|
|
|
|
file_entries_new->libs[idx_new].hwcap = entry->hwcap;
|
|
|
|
else
|
|
|
|
file_entries_new->libs[idx_new].hwcap
|
2020-12-05 15:01:58 +00:00
|
|
|
= compute_hwcap_value (entry);
|
2020-12-04 08:13:43 +00:00
|
|
|
file_entries_new->libs[idx_new].key
|
|
|
|
= str_offset + entry->lib->offset;
|
|
|
|
file_entries_new->libs[idx_new].value
|
|
|
|
= str_offset + entry->path->offset;
|
2000-05-07 21:23:56 +00:00
|
|
|
}
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
|
2000-05-07 21:23:56 +00:00
|
|
|
/* Ignore entries with hwcap for old format. */
|
|
|
|
if (entry->hwcap == 0)
|
|
|
|
++idx_old;
|
1999-12-04 08:00:00 +00:00
|
|
|
}
|
|
|
|
|
2003-08-25 18:37:54 +00:00
|
|
|
/* Duplicate last old cache entry if needed. */
|
2020-11-26 15:59:44 +00:00
|
|
|
if (opt_format != opt_format_new
|
2003-08-25 18:37:54 +00:00
|
|
|
&& idx_old < cache_entry_old_count)
|
|
|
|
file_entries->libs[idx_old] = file_entries->libs[idx_old - 1];
|
|
|
|
|
2020-12-04 08:13:43 +00:00
|
|
|
/* Compute the location of the extension directory. This
|
|
|
|
implementation puts the directory after the string table. The
|
|
|
|
size computation matches the write calls below. The extension
|
|
|
|
directory does not exist with format 0, so the value does not
|
|
|
|
matter. */
|
|
|
|
uint32_t extension_offset = 0;
|
|
|
|
if (opt_format != opt_format_new)
|
|
|
|
extension_offset += file_entries_size;
|
|
|
|
if (opt_format != opt_format_old)
|
|
|
|
{
|
|
|
|
if (opt_format != opt_format_new)
|
|
|
|
extension_offset += pad;
|
|
|
|
extension_offset += file_entries_new_size;
|
|
|
|
}
|
2020-12-04 08:13:43 +00:00
|
|
|
extension_offset += strings_finalized.size;
|
2020-12-04 08:13:43 +00:00
|
|
|
extension_offset = roundup (extension_offset, 4); /* Provide alignment. */
|
|
|
|
if (opt_format != opt_format_old)
|
|
|
|
file_entries_new->extension_offset = extension_offset;
|
|
|
|
|
1999-12-04 08:00:00 +00:00
|
|
|
/* Write out the cache. */
|
|
|
|
|
|
|
|
/* Write cache first to a temporary file and rename it later. */
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
char *temp_name = xmalloc (strlen (cache_name) + 2);
|
1999-12-04 08:00:00 +00:00
|
|
|
sprintf (temp_name, "%s~", cache_name);
|
|
|
|
|
|
|
|
/* Create file. */
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
int fd = open (temp_name, O_CREAT|O_WRONLY|O_TRUNC|O_NOFOLLOW,
|
|
|
|
S_IRUSR|S_IWUSR);
|
1999-12-04 08:00:00 +00:00
|
|
|
if (fd < 0)
|
|
|
|
error (EXIT_FAILURE, errno, _("Can't create temporary cache file %s"),
|
|
|
|
temp_name);
|
|
|
|
|
|
|
|
/* Write contents. */
|
2020-11-26 15:59:44 +00:00
|
|
|
if (opt_format != opt_format_new)
|
2000-05-07 21:23:56 +00:00
|
|
|
{
|
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 07:40:05 +00:00
|
|
|
if (write (fd, file_entries, file_entries_size)
|
2006-04-07 04:29:25 +00:00
|
|
|
!= (ssize_t) file_entries_size)
|
2000-05-07 21:23:56 +00:00
|
|
|
error (EXIT_FAILURE, errno, _("Writing of cache data failed"));
|
|
|
|
}
|
2020-11-26 15:59:44 +00:00
|
|
|
if (opt_format != opt_format_old)
|
2000-05-07 21:23:56 +00:00
|
|
|
{
|
2000-05-17 11:04:21 +00:00
|
|
|
/* Align cache. */
|
2020-11-26 15:59:44 +00:00
|
|
|
if (opt_format != opt_format_new)
|
2000-05-17 11:04:21 +00:00
|
|
|
{
|
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 07:40:05 +00:00
|
|
|
char zero[pad];
|
2006-04-07 04:29:25 +00:00
|
|
|
memset (zero, '\0', pad);
|
|
|
|
if (write (fd, zero, pad) != (ssize_t) pad)
|
2000-05-17 11:04:21 +00:00
|
|
|
error (EXIT_FAILURE, errno, _("Writing of cache data failed"));
|
|
|
|
}
|
2000-05-07 21:23:56 +00:00
|
|
|
if (write (fd, file_entries_new, file_entries_new_size)
|
2006-04-07 04:29:25 +00:00
|
|
|
!= (ssize_t) file_entries_new_size)
|
2000-05-07 21:23:56 +00:00
|
|
|
error (EXIT_FAILURE, errno, _("Writing of cache data failed"));
|
|
|
|
}
|
1999-12-04 08:00:00 +00:00
|
|
|
|
2020-12-04 08:13:43 +00:00
|
|
|
if (write (fd, strings_finalized.strings, strings_finalized.size)
|
|
|
|
!= (ssize_t) strings_finalized.size)
|
[BZ #2510, BZ #2830, BZ #3137, BZ #3313, BZ #3426, BZ #3465, BZ #3480, BZ #3483, BZ #3493, BZ #3514, BZ #3515, BZ #3664, BZ #3673, BZ #3674]
2007-01-11 Jakub Jelinek <jakub@redhat.com>
* sysdeps/i386/soft-fp/sfp-machine.h: Remove.
* sysdeps/x86_64/soft-fp/sfp-machine.h: Likewise.
2007-01-10 Ulrich Drepper <drepper@redhat.com>
* io/fts.c: Make sure fts_cur is always valid after return from
fts_read.
Patch by Miloslav Trmac <mitr@redhat.com>.
2006-10-27 Richard Sandiford <richard@codesourcery.com>
* elf/elf.h (R_MIPS_GLOB_DAT): Define.
(R_MIPS_NUM): Bump by 1.
2007-01-03 Jakub Jelinek <jakub@redhat.com>
* posix/execvp.c: Include alloca.h.
(allocate_scripts_argv): Renamed to...
(scripts_argv): ... this. Don't allocate buffer here nor count
arguments.
(execvp): Use alloca if possible.
* posix/Makefile: Add rules to build and run tst-vfork3 test.
* posix/tst-vfork3.c: New test.
* stdlib/Makefile (tst-strtod3-ENV): Define.
2007-01-02 Ulrich Drepper <drepper@redhat.com>
* posix/getconf.c: Update copyright year.
* nss/getent.c: Likewise.
* iconv/iconvconfig.c: Likewise.
* iconv/iconv_prog.c: Likewise.
* elf/ldconfig.c: Likewise.
* catgets/gencat.c: Likewise.
* csu/version.c: Likewise.
* elf/ldd.bash.in: Likewise.
* elf/sprof.c (print_version): Likewise.
* locale/programs/locale.c: Likewise.
* locale/programs/localedef.c: Likewise.
* nscd/nscd.c (print_version): Likewise.
* debug/xtrace.sh: Likewise.
* malloc/memusage.sh: Likewise.
* malloc/mtrace.pl: Likewise.
* debug/catchsegv.sh: Likewise.
2006-12-24 Ulrich Drepper <drepper@redhat.com>
* malloc/malloc.c (sYSMALLOc): Remove some unnecessary alignment
attempts.
2006-12-23 Ulrich Drepper <drepper@redhat.com>
* posix/wordexp.c: Remove some unnecessary tests.
2006-12-20 SUGIOKA Toshinobu <sugioka@itonet.co.jp>
* sysdeps/unix/sysv/linux/sh/bits/shm.h: New file.
* nss/getXXbyYY_r.c: Include atomic.h.
(INTERNAL (REENTRANT_NAME)): Write startp after start_fct,
add atomic_write_barrier () in between.
2006-11-28 Jakub Jelinek <jakub@redhat.com>
* elf/dl-support.c: Include dl-procinfo.h.
* sysdeps/powerpc/dl-procinfo.h (PPC_PLATFORM_POWER4,
PPC_PLATFORM_PPC970, PPC_PLATFORM_POWER5, PPC_PLATFORM_POWER5_PLUS,
PPC_PLATFORM_POWER6, PPC_PLATFORM_CELL_BE, PPC_PLATFORM_POWER6X):
Define.
(_dl_string_platform): Use PPC_PLATFORM_* macros instead of
hardcoded constants.
* sysdeps/powerpc/dl-procinfo.c (_dl_powerpc_platform): Use
PPC_PLATFORM_* macros for array designators.
2006-11-11 Steven Munroe <sjmunroe@us.ibm.com>
* sysdeps/powerpc/dl-procinfo.c (_dl_powerpc_cap_flags): Add 3 new cap
names to the beginning.
(_dl_powerpc_platforms): Add "power6x".
* sysdeps/powerpc/dl-procinfo.h (_DL_HWCAP_FIRST): Decrease.
(HWCAP_IMPORTANT): Add PPC_FEATURE_HAS_DFP.
(_DL_PLATFORMS_COUNT): Increase.
(_dl_string_platform): Handle power6x case.
* sysdeps/powerpc/sysdep.h (PPC_FEATURE_PA6T, PPC_FEATURE_HAS_DFP,
PPC_FEATURE_POWER6_EXT): Define.
(PPC_FEATURE_POWER5, PPC_FEATURE_POWER5_PLUS): Correct Comment.
[-2^31 .. 2^31) range.
* sysdeps/unix/sysv/linux/bits/statvfs.h: Define ST_RELATIME.
* sysdeps/unix/sysv/linux/internal_statvfs.c (__statvfs_getflags):
Handle relatime mount option.
2006-12-13 Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S: Include
kernel-features.h.
2006-12-11 Ulrich Drepper <drepper@redhat.com>
* stdlib/strtod_l.c (____STRTOF_INTERNAL): Parse thousand
separators also if no non-zero digits found.
* stdlib/Makefile (tests): Add tst-strtod3.
[BZ #3664]
* stdlib/strtod_l.c (____STRTOF_INTERNAL): Fix test to recognize
empty parsed strings.
* stdlib/Makefile (tests): Add tst-strtod2.
* stdlib/tst-strtod2.c: New file.
[BZ #3673]
* stdlib/strtod_l.c (____STRTOF_INTERNAL): Fix exp_limit
computation.
* stdlib/Makefile (tests): Add tst-atof2.
* stdlib/tst-atof2.c: New file.
[BZ #3674]
* stdlib/strtod_l.c (____STRTOF_INTERNAL): Adjust exponent value
correctly if removing trailing zero of hex-float.
* stdlib/Makefile (tests): Add tst-atof1.
* stdlib/tst-atof1.c: New file.
* misc/mntent_r.c (__hasmntopt): Check p[optlen] even when p == rest.
Start searching for next comma at p rather than rest.
* misc/Makefile (tests): Add tst-mntent2.
* misc/tst-mntent2.c: New test.
2006-12-08 Ulrich Drepper <drepper@redhat.com>
* malloc/memusage.c: Handle realloc with new size of zero and
non-NULL pointer correctly.
(me): Really write first record twice.
(struct entry): Make format bi-arch safe.
(dest): Write out more realloc statistics.
* malloc/memusagestat.c (struct entry): Make format bi-arch safe.
2006-12-05 Jakub Jelinek <jakub@redhat.com>
* nis/nis_subr.c (nis_getnames): Revert last change.
2006-12-03 Kaz Kojima <kkojima@rr.iij4u.or.jp>
* sysdeps/unix/sysv/linux/sh/sys/io.h: Removed.
2006-11-30 H.J. Lu <hongjiu.lu@intel.com>
* sysdeps/i386/i686/memcmp.S: Use jump table as the base of
jump table entries.
2006-11-30 Jan Kratochvil <jan.kratochvil@redhat.com>
* sysdeps/unix/sysv/linux/i386/clone.S: Provide CFI for the outermost
`clone' function to ensure proper unwinding stop of gdb.
* sysdeps/unix/sysv/linux/x86_64/clone.S: Likewise.
2006-12-01 Ulrich Drepper <drepper@redhat.com>
* nscd/nscd.init: Remove obsolete and commented-out -S option
handling.
2006-11-23 Jakub Jelinek <jakub@redhat.com>
[BZ #3514]
* manual/string.texi (strncmp): Fix pastos from wcscmp description.
[BZ #3515]
* manual/string.texi (strtok): Remove duplicate paragraph.
2006-12-01 Jan Kratochvil <jan.kratochvil@redhat.com>
* sysdeps/unix/sysv/linux/x86_64/sigaction.c: Fix compatibility with
libgcc not supporting `rflags' unwinding (register # >= 17).
2006-11-30 Jakub Jelinek <jakub@redhat.com>
* sunrpc/svc_run.c (svc_run): Set my_pollfd to new_pollfd if realloc
succeeded.
2006-11-29 Daniel Jacobowitz <dan@codesourcery.com>
Jakub Jelinek <jakub@redhat.com>
Jan Kratochvil <jan.kratochvil@redhat.com>
* sysdeps/unix/sysv/linux/x86_64/sigaction.c (restore_rt): Add correct
unwind information.
* sysdeps/unix/sysv/linux/x86_64/Makefile: Provide symbols for
'restore_rt' even in the 'signal' directory.
* sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym: Extend the regs list.
malloc crashed. Don't allocate memory unnecessarily in each
loop.
2006-10-21 Jakub Jelinek <jakub@redhat.com>
* resolv/mapv4v6addr.h (map_v4v6_address): Fix last change.
2006-11-20 Ulrich Drepper <drepper@redhat.com>
* resolv/mapv4v6addr.h (map_v4v6_address): Optimize a bit.
2006-11-18 Bruno Haible <bruno@clisp.org>
* sysdeps/unix/sysv/linux/i386/getgroups.c (__getgroups): Invoke
__sysconf only after having tried to call getgroups32.
2006-11-19 Ulrich Drepper <drepper@redhat.com>
* nss/nss_files/files-hosts.c (LINE_PARSER): Support IPv6-style
addresses for IPv4 queries if they can be mapped.
2006-11-16 Jakub Jelinek <jakub@redhat.com>
* sysdeps/x86_64/fpu/s_copysignf.S (__copysignf): Switch to .text.
* sysdeps/x86_64/fpu/s_copysign.S (__copysign): Likewise.
(signmask): Add .size directive.
(othermask): Add .type directive.
2006-11-14 Ulrich Drepper <drepper@redhat.com>
* po/nl.po: Update from translation team.
* timezone/zdump.c: Redo fix for BZ #3137.
2006-11-14 Jakub Jelinek <jakub@redhat.com>
* nss/nss_files/files-alias.c (get_next_alias): Set line back
to first_unused after parsing :include: file.
* timezone/africa: Update from tzdata2006o.
* timezone/antarctica: Likewise.
* timezone/asia: Likewise.
* timezone/australasia: Likewise.
* timezone/backward: Likewise.
* timezone/europe: Likewise.
* timezone/iso3166.tab: Likewise.
* timezone/northamerica: Likewise.
* timezone/southamerica: Likewise.
* timezone/zone.tab: Likewise.
* time/tzfile.c (__tzfile_read): Extend to handle new file format
on machines with 64-bit time_t.
* timezone/checktab.awk: Update from tzcode2006o.
* timezone/ialloc.c: Likewise.
* timezone/private.h: Likewise.
* timezone/scheck.c: Likewise.
* timezone/tzfile.h: Likewise.
* timezone/tzselect.ksh: Likewise.
* timezone/zdump.c: Likewise.
* timezone/zic.c: Likewise.
[BZ #3483]
* elf/ldconfig.c (main): Call setlocale and textdomain.
Patch mostly by Benno Schulenberg <bensberg@justemail.net>.
[BZ #3480]
* manual/argp.texi: Fix typos.
* manual/charset.texi: Likewise.
* manual/errno.texi: Likewise.
* manual/filesys.texi: Likewise.
* manual/lang.texi: Likewise.
* manual/maint.texi: Likewise.
* manual/memory.texi: Likewise.
* manual/message.texi: Likewise.
* manual/resource.texi: Likewise.
* manual/search.texi: Likewise.
* manual/signal.texi: Likewise.
* manual/startup.texi: Likewise.
* manual/stdio.texi: Likewise.
* manual/sysinfo.texi: Likewise.
* manual/syslog.texi: Likewise.
* manual/time.texi: Likewise.
Patch by Ralf Wildenhues <Ralf.Wildenhues@gmx.de>.
[BZ #3465]
* sunrpc/clnt_raw.c: Minimal message improvements.
* sunrpc/pm_getmaps.c: Likewise.
* nis/nss_nisplus/nisplus-publickey.c: Likewise.
* nis/nis_print_group_entry.c: Likewise.
* locale/programs/repertoire.c: Likewise.
* locale/programs/charmap.c: Likewise.
* malloc/memusage.sh: Likewise.
* elf/dl-deps.c: Likewise.
* locale/programs/ld-collate.c: Likewise.
* libio/vswprintf.c: Likewise.
* malloc/memusagestat.c: Likewise.
* sunrpc/auth_unix.c: Likewise.
* sunrpc/rpc_main.c: Likewise.
* nscd/cache.c: Likewise.
* locale/programs/repertoire.c: Unify output messages.
* locale/programs/charmap.c: Likewise.
* locale/programs/ld-ctype.c: Likewise.
* locale/programs/ld-monetary.c: Likewise.
* locale/programs/ld-numeric.c: Likewise.
* locale/programs/ld-time.c: Likewise.
* elf/ldconfig.c: Likewise.
* nscd/selinux.c: Likewise.
* elf/cache.c: Likewise.
Patch mostly by Benno Schulenberg <bensberg@justemail.net>.
2006-11-10 Jakub Jelinek <jakub@redhat.com>
* string/strxfrm_l.c (STRXFRM): Fix trailing \1 optimization
if N is one bigger than return value.
* string/tst-strxfrm2.c (do_test): Also test strxfrm with l1 + 1
and l1 last arguments, if buf is defined, verify the return value
equals to strlen (buf) and verify no byte beyond passed length
is modified.
2006-11-10 Ulrich Drepper <drepper@redhat.com>
* po/sv.po: Update from translation team.
* sysdeps/gnu/siglist.c (__old_sys_siglist, __old_sys_sigabbrev):
Use __new_sys_siglist instead of _sys_siglist_internal as
second macro argument.
(_old_sys_siglist): Use declare_symbol_alias macro instead of
strong_alias.
2006-11-09 Ulrich Drepper <drepper@redhat.com>
[BZ #3493]
* posix/unistd.h (sysconf): Remove const attribute.
* sysdeps/posix/getaddrinfo.c (getaddrinfo): Fix test for
temporary or deprecated addresses.
Patch by Sridhar Samudrala <sri@us.ibm.com>.
* string/Makefile (tests): Add tst-strxfrm2.
* string/tst-strxfrm2.c: New file.
2006-10-09 Jakub Jelinek <jakub@redhat.com>
* elf/dl-debug.c (_dl_debug_initialize): Check r->r_map for 0
rather than r->r_brk.
* string/strxfrm_l.c (STRXFRM): Do the trailing \1 removal
optimization even if needed > n.
2006-11-07 Jakub Jelinek <jakub@redhat.com>
* include/libc-symbols.h (declare_symbol): Rename to...
(declare_symbol_alias): ... this. Add ORIGINAL argument, imply
strong_alias (ORIGINAL, SYMBOL) in asm to make sure it preceedes
.size directive.
* sysdeps/gnu/errlist-compat.awk: Adjust for declare_symbol_alias
changes.
* sysdeps/gnu/siglist.c: Likewise.
2006-11-03 Steven Munroe <sjmunroe@us.ibm.com>
* sysdeps/powerpc/fpu/bits/mathinline.h
[__LIBC_INTERNAL_MATH_INLINES]: Moved to ...
* sysdeps/powerpc/fpu/math_private.h: ...here. New file.
2006-11-05 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/sysconf.c (intel_check_word):
Update handling of cache descriptor 0x49 for new models.
* sysdeps/unix/sysv/linux/x86_64/sysconf.c (intel_check_word):
Likewise.
2006-11-02 Ulrich Drepper <drepper@redhat.com>
* configure.in: Work around ld --help change and avoid -z relro
test completely if the architecture doesn't care about security.
2006-11-01 Ulrich Drepper <drepper@redhat.com>
* po/sv.po: Update from translation team.
2006-10-31 Ulrich Drepper <drepper@redhat.com>
* stdlib/atexit.c (atexit): Don't mark as hidden when used to
generate compatibility version.
2006-10-29 Ulrich Drepper <drepper@redhat.com>
* configure.in: Relax -z relro requirement a bit.
* po/sv.po: Update from translation team.
2006-10-29 Jakub Jelinek <jakub@redhat.com>
* elf/dl-sym.c (do_sym): Use RTLD_SINGLE_THREAD_P.
* elf/dl-runtime.c (_dl_fixup, _dl_profile_fixup): Likewise.
* elf/dl-close.c (_dl_close_worker): Likewise.
* elf/dl-open.c (_dl_open_worker): Likewise.
* sysdeps/generic/sysdep-cancel.h (RTLD_SINGLE_THREAD_P): Define.
* configure.in: Require assembler support for visibility, compiler
support for visibility and aliases, linker support for various -z
options.
* Makeconfig: Remove conditional code which now is unnecessary.
* config.h.in: Likewise.
* config.make.in: Likewise.
* dlfcn/Makefile: Likewise.
* elf/Makefile: Likewise.
* elf/dl-load.c: Likewise.
* elf/rtld.c: Likewise.
* include/libc-symbols.h: Likewise.
* include/stdio.h: Likewise.
* io/Makefile: Likewise.
* io/fstat.c: Likewise.
* io/fstat64.c: Likewise.
* io/fstatat.c: Likewise.
* io/fstatat64.c: Likewise.
* io/lstat.c: Likewise.
* io/lstat64.c: Likewise.
* io/mknod.c: Likewise.
* io/mknodat.c: Likewise.
* io/stat.c: Likewise.
* io/stat64.c: Likewise.
* libio/stdio.c: Likewise.
* nscd/Makefile: Likewise.
* stdlib/Makefile: Likewise.
* stdlib/atexit.c: Likewise.
* sysdeps/generic/ldsodefs.h: Likewise.
* sysdeps/i386/dl-machine.h: Likewise.
* sysdeps/i386/sysdep.h: Likewise.
* sysdeps/i386/i686/memcmp.S: Likewise.
* sysdeps/powerpc/powerpc32/sysdep.h: Likewise.
* sysdeps/unix/sysv/linux/i386/sigaction.c: Likewise.
* sysdeps/unix/sysv/linux/x86_64/sigaction.c: Likewise.
* Makerules: USE_TLS support is now default.
* tls.make.c: Likewise.
* csu/Versions: Likewise.
* csu/libc-start.c: Likewise.
* csu/libc-tls.c: Likewise.
* csu/version.c: Likewise.
* dlfcn/dlinfo.c: Likewise.
* elf/dl-addr.c: Likewise.
* elf/dl-cache.c: Likewise.
* elf/dl-close.c: Likewise.
* elf/dl-iteratephdr.c: Likewise.
* elf/dl-load.c: Likewise.
* elf/dl-lookup.c: Likewise.
* elf/dl-object.c: Likewise.
* elf/dl-open.c: Likewise.
* elf/dl-reloc.c: Likewise.
* elf/dl-support.c: Likewise.
* elf/dl-sym.c: Likewise.
* elf/dl-sysdep.c: Likewise.
* elf/dl-tls.c: Likewise.
* elf/ldconfig.c: Likewise.
* elf/rtld.c: Likewise.
* elf/tst-tls-dlinfo.c: Likewise.
* elf/tst-tls1.c: Likewise.
* elf/tst-tls10.h: Likewise.
* elf/tst-tls14.c: Likewise.
* elf/tst-tls2.c: Likewise.
* elf/tst-tls3.c: Likewise.
* elf/tst-tls4.c: Likewise.
* elf/tst-tls5.c: Likewise.
* elf/tst-tls6.c: Likewise.
* elf/tst-tls7.c: Likewise.
* elf/tst-tls8.c: Likewise.
* elf/tst-tls9.c: Likewise.
* elf/tst-tlsmod1.c: Likewise.
* elf/tst-tlsmod13.c: Likewise.
* elf/tst-tlsmod13a.c: Likewise.
* elf/tst-tlsmod14a.c: Likewise.
* elf/tst-tlsmod2.c: Likewise.
* elf/tst-tlsmod3.c: Likewise.
* elf/tst-tlsmod4.c: Likewise.
* elf/tst-tlsmod5.c: Likewise.
* elf/tst-tlsmod6.c: Likewise.
* include/errno.h: Likewise.
* include/link.h: Likewise.
* include/tls.h: Likewise.
* locale/global-locale.c: Likewise.
* locale/localeinfo.h: Likewise.
* malloc/arena.c: Likewise.
* malloc/hooks.c: Likewise.
* malloc/malloc.c: Likewise.
* resolv/Versions: Likewise.
* sysdeps/alpha/dl-machine.h: Likewise.
* sysdeps/alpha/libc-tls.c: Likewise.
* sysdeps/generic/ldsodefs.h: Likewise.
* sysdeps/generic/tls.h: Likewise.
* sysdeps/i386/dl-machine.h: Likewise.
* sysdeps/ia64/dl-machine.h: Likewise.
* sysdeps/ia64/libc-tls.c: Likewise.
* sysdeps/mach/hurd/fork.c: Likewise.
* sysdeps/mach/hurd/i386/tls.h: Likewise.
* sysdeps/powerpc/powerpc32/dl-machine.c: Likwise.
* sysdeps/powerpc/powerpc32/dl-machine.h: Likewise.
* sysdeps/powerpc/powerpc64/dl-machine.h: Likewise.
* sysdeps/s390/libc-tls.c: Likewise.
* sysdeps/s390/s390-32/dl-machine.h: Likewise.
* sysdeps/s390/s390-64/dl-machine.h: Likewise.
* sysdeps/sh/dl-machine.h: Likewise.
* sysdeps/sparc/sparc32/dl-machine.h: Likewise.
* sysdeps/sparc/sparc64/dl-machine.h: Likewise.
* sysdeps/x86_64/dl-machine.h: Likewise.
[BZ #3426]
* stdlib/stdlib.h: Adjust comment for canonicalize_file_name to
reality.
2006-10-27 Jakub Jelinek <jakub@redhat.com>
* elf/dl-lookup.c (_dl_debug_bindings): Remove unused symbol_scope
argument.
(_dl_lookup_symbol_x): Adjust caller.
* sysdeps/generic/ldsodefs.h (struct link_namespaces): Remove
_ns_global_scope.
* elf/rtld.c (dl_main): Don't initialize _ns_global_scope.
* elf/dl-libc.c: Revert l_scope name changes.
* elf/dl-load.c: Likewise.
* elf/dl-object.c: Likewise.
* elf/rtld.c: Likewise.
* elf/dl-close.c (_dl_close): Likewise.
* elf/dl-open.c (dl_open_worker): Likewise. If not SINGLE_THREAD_P,
always use __rtld_mrlock_{change,done}. Always free old scope list
here if not l_scope_mem.
* elf/dl-runtime.c (_dl_fixup, _dl_profile_fixup): Revert l_scope name
change. Never free scope list here. Just __rtld_mrlock_lock before
the lookup and __rtld_mrlock_unlock it after the lookup.
* elf/dl-sym.c: Likewise.
* include/link.h (struct r_scoperec): Remove.
(struct link_map): Replace l_scoperec with l_scope, l_scoperec_mem
with l_scope_mem and l_scoperec_lock with l_scope_lock.
2006-10-25 Ulrich Drepper <drepper@redhat.com>
* sysdeps/gnu/netinet/tcp.h: Define TCP_CONGESTION.
2006-10-18 Ulrich Drepper <drepper@redhat.com>
* configure.in: Disable building profile libraries by default.
2006-10-18 Ulrich Drepper <drepper@redhat.com>
* elf/dl-lookup.c (_dl_lookup_symbol_x): Add warning to
_dl_lookup_symbol_x code.
2006-10-17 Jakub Jelinek <jakub@redhat.com>
* elf/dl-runtime.c: Include sysdep-cancel.h.
(_dl_fixup, _dl_profile_fixup): Use __rtld_mrlock_* and
scoperec->nusers only if !SINGLE_THREAD_P. Use atomic_*
instead of catomic_* macros.
* elf/dl-sym.c: Include sysdep-cancel.h.
(do_sym): Use __rtld_mrlock_* and scoperec->nusers only
if !SINGLE_THREAD_P. Use atomic_* instead of catomic_* macros.
* elf/dl-close.c: Include sysdep-cancel.h.
(_dl_close): Use __rtld_mrlock_* and scoperec->nusers only
if !SINGLE_THREAD_P. Use atomic_* instead of catomic_* macros.
* elf/dl-open.c: Include sysdep-cancel.h.
(dl_open_worker): Use __rtld_mrlock_* and scoperec->nusers only
if !SINGLE_THREAD_P. Use atomic_* instead of catomic_* macros.
2006-10-17 Jakub Jelinek <jakub@redhat.com>
[BZ #3313]
* malloc/malloc.c (malloc_consolidate): Set maxfb to address of last
fastbin rather than end of fastbin array.
2006-10-18 Ulrich Drepper <drepper@redhat.com>
* sysdeps/i386/i486/bits/atomic.h (catomic_decrement): Use correct
body macro.
* sysdeps/x86_64/bits/atomic.h
(__arch_c_compare_and_exchange_val_64_acq): Add missing casts.
(catomic_decrement): Use correct body macro.
2006-10-17 Jakub Jelinek <jakub@redhat.com>
* include/atomic.h: Add a unique prefix to all local variables
in macros.
* csu/tst-atomic.c (do_test): Test also catomic_* macros.
2006-10-14 Ulrich Drepper <drepper@redhat.com>
* resolv/arpa/nameser.h: Document that ns_t_a6 is deprecated.
[BZ #3313]
* malloc/malloc.c (malloc_consolidate): Don't use get_fast_max to
determine highest fast bin to consolidate, always look into all of
them.
(do_check_malloc_state): Only require for empty bins for large
sizes in main arena.
* libio/stdio.h: Add more __wur attributes.
2006-11-12 Andreas Jaeger <aj@suse.de>
[BZ #2510]
* manual/search.texi (Hash Search Function): Clarify.
(Array Search Function): Clarify.
2006-11-12 Joseph Myers <joseph@codesourcery.com>
[BZ #2830]
* math/atest-exp.c (main): Cast hex value to mp_limb_t before
shifting.
* math/atest-exp2.c (read_mpn_hex): Likewise.
* math/atest-sincos.c (main): Likewise.
* sysdeps/unix/sysv/linux/syscalls.list: Add epoll_pwait.
* sysdeps/unix/sysv/linux/sys/epoll.h: Declare epoll_pwait.
* sysdeps/unix/sysv/linux/Versions (libc): Add epoll_pwait for
version GLIBC_2.6.
* Versions.def: Add GLIBC_2.6 for libc.
* sysdeps/i386/i486/bits/atomic.h: Add catomic_* support.
2006-10-11 Jakub Jelinek <jakub@redhat.com>
* malloc/malloc.c (_int_malloc): Remove unused any_larger variable.
* nis/nis_defaults.c (__nis_default_access): Don't call getenv twice.
* nis/nis_subr.c (nis_getnames): Use __secure_getenv instead of getenv.
* sysdeps/generic/unsecvars.h: Add NIS_PATH.
2006-10-11 Ulrich Drepper <drepper@redhat.com>
* include/atomic.c: Define catomic_* operations.
* sysdeps/x86_64/bits/atomic.h: Likewise. Fix a few minor problems.
* stdlib/cxa_finalize.c: Use catomic_* operations instead of atomic_*.
* malloc/memusage.c: Likewise.
* gmon/mcount.c: Likewise.
* elf/dl-close.c: Likewise.
* elf/dl-open.c: Likewise.
* elf/dl-profile.c: Likewise.
* elf/dl-sym.c: Likewise.
* elf/dl-runtime.c: Likewise.
* elf/dl-fptr.c: Likewise.
* resolv/res_libc.c: Likewise.
2006-10-10 Roland McGrath <roland@frob.com>
* sysdeps/mach/hurd/utimes.c: Use a union to avoid an improper cast.
* sysdeps/mach/hurd/futimes.c: Likewise.
* sysdeps/mach/hurd/lutimes.c: Likewise.
2006-10-09 Ulrich Drepper <drepper@redhat.com>
Jakub Jelinek <jakub@redhat.com>
Implement reference counting of scope records.
* elf/dl-close.c (_dl_close): Remove all scopes from removed objects
from the list in objects which remain. Always allocate new scope
record.
* elf/dl-open.c (dl_open_worker): When growing array for scopes,
don't resize, allocate a new one.
* elf/dl-runtime.c: Update reference counters before using a scope
array.
* elf/dl-sym.c: Likewise.
* elf/dl-libc.c: Adjust for l_scope name change.
* elf/dl-load.c: Likewise.
* elf/dl-object.c: Likewise.
* elf/rtld.c: Likewise.
* include/link.h: Include <rtld-lowlevel.h>. Define struct
r_scoperec. Replace r_scope with pointer to r_scoperec structure.
Add l_scoperec_lock.
* sysdeps/generic/ldsodefs.h: Include <rtld-lowlevel.h>.
* sysdeps/generic/rtld-lowlevel.h: New file.
* include/atomic.h: Rename atomic_and to atomic_and_val and
atomic_or to atomic_or_val. Define new macros atomic_and and
atomic_or which do not return values.
* sysdeps/x86_64/bits/atomic.h: Define atomic_and and atomic_or.
Various cleanups.
* sysdeps/i386/i486/bits/atomic.h: Likewise.
* po/sv.po: Update from translation team.
2006-10-07 Ulrich Drepper <drepper@redhat.com>
* Versions.def: Add GLIBC_2.6 to libpthread.
* include/shlib-compat.h (SHLIB_COMPAT): Expand parameters before use.
(versioned_symbol): Likewise.
(compat_symbol): Likewise.
* po/tr.po: Update from translation team.
* nis/Banner: Removed. It's been integral part forever and the
author info is incomplete anyway.
* libio/Banner: Likewise.
2006-10-06 Ulrich Drepper <drepper@redhat.com>
* version.h (VERSION): Bump to 2.5.90 for new development tree.
2007-01-11 21:51:07 +00:00
|
|
|
error (EXIT_FAILURE, errno, _("Writing of cache data failed"));
|
1999-12-04 08:00:00 +00:00
|
|
|
|
2020-12-04 08:13:43 +00:00
|
|
|
if (opt_format != opt_format_old)
|
|
|
|
{
|
|
|
|
/* Align file position to 4. */
|
|
|
|
off64_t old_offset = lseek64 (fd, extension_offset, SEEK_SET);
|
|
|
|
assert ((unsigned long long int) (extension_offset - old_offset) < 4);
|
2020-12-04 08:13:43 +00:00
|
|
|
write_extensions (fd, str_offset, extension_offset);
|
2020-12-04 08:13:43 +00:00
|
|
|
}
|
|
|
|
|
2000-04-10 16:22:52 +00:00
|
|
|
/* Make sure user can always read cache file */
|
2001-02-27 17:59:27 +00:00
|
|
|
if (chmod (temp_name, S_IROTH|S_IRGRP|S_IRUSR|S_IWUSR))
|
2000-04-10 16:22:52 +00:00
|
|
|
error (EXIT_FAILURE, errno,
|
2001-02-27 17:59:27 +00:00
|
|
|
_("Changing access rights of %s to %#o failed"), temp_name,
|
|
|
|
S_IROTH|S_IRGRP|S_IRUSR|S_IWUSR);
|
2000-04-10 16:22:52 +00:00
|
|
|
|
2018-02-21 09:42:48 +00:00
|
|
|
/* Make sure that data is written to disk. */
|
|
|
|
if (fsync (fd) != 0 || close (fd) != 0)
|
|
|
|
error (EXIT_FAILURE, errno, _("Writing of cache data failed"));
|
|
|
|
|
1999-12-04 08:00:00 +00:00
|
|
|
/* Move temporary to its final location. */
|
|
|
|
if (rename (temp_name, cache_name))
|
|
|
|
error (EXIT_FAILURE, errno, _("Renaming of %s to %s failed"), temp_name,
|
|
|
|
cache_name);
|
2000-04-10 16:22:52 +00:00
|
|
|
|
1999-12-04 08:00:00 +00:00
|
|
|
/* Free all allocated memory. */
|
2006-04-07 04:29:25 +00:00
|
|
|
free (file_entries_new);
|
1999-12-04 08:00:00 +00:00
|
|
|
free (file_entries);
|
2020-12-04 08:13:43 +00:00
|
|
|
free (strings_finalized.strings);
|
2021-05-18 03:38:41 +00:00
|
|
|
free (temp_name);
|
1999-12-04 08:00:00 +00:00
|
|
|
|
|
|
|
while (entries)
|
|
|
|
{
|
|
|
|
entry = entries;
|
|
|
|
entries = entries->next;
|
|
|
|
free (entry);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-05-07 21:23:56 +00:00
|
|
|
|
1999-12-04 08:00:00 +00:00
|
|
|
/* Add one library to the cache. */
|
|
|
|
void
|
2020-12-04 08:13:43 +00:00
|
|
|
add_to_cache (const char *path, const char *filename, const char *soname,
|
2020-12-05 15:01:58 +00:00
|
|
|
int flags, unsigned int osversion,
|
|
|
|
unsigned int isa_level, uint64_t hwcap,
|
2020-12-04 08:13:43 +00:00
|
|
|
struct glibc_hwcaps_subdirectory *hwcaps)
|
1999-12-04 08:00:00 +00:00
|
|
|
{
|
2020-12-04 08:13:43 +00:00
|
|
|
struct cache_entry *new_entry = xmalloc (sizeof (*new_entry));
|
|
|
|
|
|
|
|
struct stringtable_entry *path_interned;
|
|
|
|
{
|
|
|
|
char *p;
|
2020-12-04 08:13:43 +00:00
|
|
|
if (asprintf (&p, "%s/%s", path, filename) < 0)
|
2020-12-04 08:13:43 +00:00
|
|
|
error (EXIT_FAILURE, errno, _("Could not create library path"));
|
|
|
|
path_interned = stringtable_add (&strings, p);
|
|
|
|
free (p);
|
|
|
|
}
|
|
|
|
|
2020-12-04 08:13:43 +00:00
|
|
|
new_entry->lib = stringtable_add (&strings, soname);
|
2020-12-04 08:13:43 +00:00
|
|
|
new_entry->path = path_interned;
|
1999-12-04 08:00:00 +00:00
|
|
|
new_entry->flags = flags;
|
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 07:40:05 +00:00
|
|
|
new_entry->osversion = osversion;
|
2020-12-05 15:01:58 +00:00
|
|
|
new_entry->isa_level = isa_level;
|
2000-05-07 21:23:56 +00:00
|
|
|
new_entry->hwcap = hwcap;
|
2020-12-04 08:13:43 +00:00
|
|
|
new_entry->hwcaps = hwcaps;
|
2000-05-07 21:23:56 +00:00
|
|
|
new_entry->bits_hwcap = 0;
|
|
|
|
|
2020-12-04 08:13:43 +00:00
|
|
|
if (hwcaps != NULL)
|
|
|
|
{
|
|
|
|
assert (hwcap == 0);
|
|
|
|
hwcaps->used = true;
|
|
|
|
}
|
|
|
|
|
2000-05-07 21:23:56 +00:00
|
|
|
/* Count the number of bits set in the masked value. */
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
for (size_t i = 0;
|
|
|
|
(~((1ULL << i) - 1) & hwcap) != 0 && i < 8 * sizeof (hwcap); ++i)
|
2000-11-15 08:42:13 +00:00
|
|
|
if ((hwcap & (1ULL << i)) != 0)
|
2000-05-07 21:23:56 +00:00
|
|
|
++new_entry->bits_hwcap;
|
|
|
|
|
1999-12-04 08:00:00 +00:00
|
|
|
|
|
|
|
/* Keep the list sorted - search for right place to insert. */
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
struct cache_entry *ptr = entries;
|
|
|
|
struct cache_entry *prev = entries;
|
1999-12-04 08:00:00 +00:00
|
|
|
while (ptr != NULL)
|
|
|
|
{
|
|
|
|
if (compare (ptr, new_entry) > 0)
|
|
|
|
break;
|
|
|
|
prev = ptr;
|
|
|
|
ptr = ptr->next;
|
|
|
|
}
|
|
|
|
/* Is this the first entry? */
|
|
|
|
if (ptr == entries)
|
|
|
|
{
|
|
|
|
new_entry->next = entries;
|
|
|
|
entries = new_entry;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
new_entry->next = prev->next;
|
|
|
|
prev->next = new_entry;
|
|
|
|
}
|
|
|
|
}
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Auxiliary cache. */
|
|
|
|
|
|
|
|
struct aux_cache_entry_id
|
|
|
|
{
|
|
|
|
uint64_t ino;
|
|
|
|
uint64_t ctime;
|
|
|
|
uint64_t size;
|
|
|
|
uint64_t dev;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct aux_cache_entry
|
|
|
|
{
|
|
|
|
struct aux_cache_entry_id id;
|
|
|
|
int flags;
|
|
|
|
unsigned int osversion;
|
2020-12-05 15:01:58 +00:00
|
|
|
unsigned int isa_level;
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
int used;
|
|
|
|
char *soname;
|
|
|
|
struct aux_cache_entry *next;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define AUX_CACHEMAGIC "glibc-ld.so.auxcache-1.0"
|
|
|
|
|
|
|
|
struct aux_cache_file_entry
|
|
|
|
{
|
|
|
|
struct aux_cache_entry_id id; /* Unique id of entry. */
|
|
|
|
int32_t flags; /* This is 1 for an ELF library. */
|
|
|
|
uint32_t soname; /* String table indice. */
|
|
|
|
uint32_t osversion; /* Required OS version. */
|
2020-12-05 15:01:58 +00:00
|
|
|
uint32_t isa_level; /* Required ISA level. */
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* ldconfig maintains an auxiliary cache file that allows
|
|
|
|
only reading those libraries that have changed since the last iteration.
|
|
|
|
For this for each library some information is cached in the auxiliary
|
|
|
|
cache. */
|
|
|
|
struct aux_cache_file
|
|
|
|
{
|
|
|
|
char magic[sizeof AUX_CACHEMAGIC - 1];
|
|
|
|
uint32_t nlibs; /* Number of entries. */
|
|
|
|
uint32_t len_strings; /* Size of string table. */
|
|
|
|
struct aux_cache_file_entry libs[0]; /* Entries describing libraries. */
|
|
|
|
/* After this the string table of size len_strings is found. */
|
|
|
|
};
|
|
|
|
|
2007-08-13 00:23:59 +00:00
|
|
|
static const unsigned int primes[] =
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
{
|
|
|
|
1021, 2039, 4093, 8191, 16381, 32749, 65521, 131071, 262139,
|
|
|
|
524287, 1048573, 2097143, 4194301, 8388593, 16777213, 33554393,
|
|
|
|
67108859, 134217689, 268435399, 536870909, 1073741789, 2147483647
|
|
|
|
};
|
|
|
|
|
|
|
|
static size_t aux_hash_size;
|
|
|
|
static struct aux_cache_entry **aux_hash;
|
|
|
|
|
|
|
|
/* Simplistic hash function for aux_cache_entry_id. */
|
|
|
|
static unsigned int
|
|
|
|
aux_cache_entry_id_hash (struct aux_cache_entry_id *id)
|
|
|
|
{
|
|
|
|
uint64_t ret = ((id->ino * 11 + id->ctime) * 11 + id->size) * 11 + id->dev;
|
|
|
|
return ret ^ (ret >> 32);
|
|
|
|
}
|
|
|
|
|
|
|
|
static size_t nextprime (size_t x)
|
|
|
|
{
|
|
|
|
for (unsigned int i = 0; i < sizeof (primes) / sizeof (primes[0]); ++i)
|
|
|
|
if (primes[i] >= x)
|
|
|
|
return primes[i];
|
|
|
|
return x;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
init_aux_cache (void)
|
|
|
|
{
|
|
|
|
aux_hash_size = primes[3];
|
|
|
|
aux_hash = xcalloc (aux_hash_size, sizeof (struct aux_cache_entry *));
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2021-12-29 13:20:46 +00:00
|
|
|
search_aux_cache (struct stat *stat_buf, int *flags,
|
2020-12-05 15:01:58 +00:00
|
|
|
unsigned int *osversion, unsigned int *isa_level,
|
|
|
|
char **soname)
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
{
|
|
|
|
struct aux_cache_entry_id id;
|
|
|
|
id.ino = (uint64_t) stat_buf->st_ino;
|
|
|
|
id.ctime = (uint64_t) stat_buf->st_ctime;
|
|
|
|
id.size = (uint64_t) stat_buf->st_size;
|
|
|
|
id.dev = (uint64_t) stat_buf->st_dev;
|
|
|
|
|
|
|
|
unsigned int hash = aux_cache_entry_id_hash (&id);
|
|
|
|
struct aux_cache_entry *entry;
|
|
|
|
for (entry = aux_hash[hash % aux_hash_size]; entry; entry = entry->next)
|
|
|
|
if (id.ino == entry->id.ino
|
|
|
|
&& id.ctime == entry->id.ctime
|
|
|
|
&& id.size == entry->id.size
|
|
|
|
&& id.dev == entry->id.dev)
|
|
|
|
{
|
|
|
|
*flags = entry->flags;
|
|
|
|
*osversion = entry->osversion;
|
2020-12-05 15:01:58 +00:00
|
|
|
*isa_level = entry->isa_level;
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
if (entry->soname != NULL)
|
|
|
|
*soname = xstrdup (entry->soname);
|
|
|
|
else
|
|
|
|
*soname = NULL;
|
|
|
|
entry->used = 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
insert_to_aux_cache (struct aux_cache_entry_id *id, int flags,
|
2020-12-05 15:01:58 +00:00
|
|
|
unsigned int osversion, unsigned int isa_level,
|
|
|
|
const char *soname, int used)
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
{
|
|
|
|
size_t hash = aux_cache_entry_id_hash (id) % aux_hash_size;
|
|
|
|
struct aux_cache_entry *entry;
|
|
|
|
for (entry = aux_hash[hash]; entry; entry = entry->next)
|
|
|
|
if (id->ino == entry->id.ino
|
|
|
|
&& id->ctime == entry->id.ctime
|
|
|
|
&& id->size == entry->id.size
|
|
|
|
&& id->dev == entry->id.dev)
|
|
|
|
abort ();
|
|
|
|
|
|
|
|
size_t len = soname ? strlen (soname) + 1 : 0;
|
|
|
|
entry = xmalloc (sizeof (struct aux_cache_entry) + len);
|
|
|
|
entry->id = *id;
|
|
|
|
entry->flags = flags;
|
|
|
|
entry->osversion = osversion;
|
2020-12-05 15:01:58 +00:00
|
|
|
entry->isa_level = isa_level;
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
entry->used = used;
|
|
|
|
if (soname != NULL)
|
|
|
|
entry->soname = memcpy ((char *) (entry + 1), soname, len);
|
|
|
|
else
|
|
|
|
entry->soname = NULL;
|
|
|
|
entry->next = aux_hash[hash];
|
|
|
|
aux_hash[hash] = entry;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2021-12-29 13:20:46 +00:00
|
|
|
add_to_aux_cache (struct stat *stat_buf, int flags,
|
2020-12-05 15:01:58 +00:00
|
|
|
unsigned int osversion, unsigned int isa_level,
|
|
|
|
const char *soname)
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
{
|
|
|
|
struct aux_cache_entry_id id;
|
|
|
|
id.ino = (uint64_t) stat_buf->st_ino;
|
|
|
|
id.ctime = (uint64_t) stat_buf->st_ctime;
|
|
|
|
id.size = (uint64_t) stat_buf->st_size;
|
|
|
|
id.dev = (uint64_t) stat_buf->st_dev;
|
2020-12-05 15:01:58 +00:00
|
|
|
insert_to_aux_cache (&id, flags, osversion, isa_level, soname, 1);
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Load auxiliary cache to search for unchanged entries. */
|
|
|
|
void
|
|
|
|
load_aux_cache (const char *aux_cache_name)
|
|
|
|
{
|
|
|
|
int fd = open (aux_cache_name, O_RDONLY);
|
|
|
|
if (fd < 0)
|
|
|
|
{
|
|
|
|
init_aux_cache ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-12-29 13:20:46 +00:00
|
|
|
struct stat st;
|
|
|
|
if (fstat (fd, &st) < 0 || st.st_size < sizeof (struct aux_cache_file))
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
{
|
|
|
|
close (fd);
|
|
|
|
init_aux_cache ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t aux_cache_size = st.st_size;
|
|
|
|
struct aux_cache_file *aux_cache
|
|
|
|
= mmap (NULL, aux_cache_size, PROT_READ, MAP_PRIVATE, fd, 0);
|
|
|
|
if (aux_cache == MAP_FAILED
|
|
|
|
|| aux_cache_size < sizeof (struct aux_cache_file)
|
|
|
|
|| memcmp (aux_cache->magic, AUX_CACHEMAGIC, sizeof AUX_CACHEMAGIC - 1)
|
2019-02-27 13:55:45 +00:00
|
|
|
|| aux_cache_size != (sizeof (struct aux_cache_file)
|
|
|
|
+ aux_cache->nlibs * sizeof (struct aux_cache_file_entry)
|
Break some lines before not after operators.
The GNU Coding Standards specify that line breaks in expressions
should go before an operator, not after one. This patch fixes various
code to do this. It only changes code that appears to be mostly
following GNU style anyway, not files and directories with
substantially different formatting. It is not exhaustive even for
files using GNU style (for example, changes to sysdeps files are
deferred for subsequent cleanups). Some files changed are shared with
gnulib, but most are specific to glibc. Changes were made manually,
with places to change found by grep (so some cases, e.g. where the
operator was followed by a comment at end of line, are particularly
liable to have been missed by grep, but I did include cases where the
operator was followed by backslash-newline).
This patch generally does not attempt to address other coding style
issues in the expressions changed (for example, missing spaces before
'(', or lack of parentheses to ensure indentation of continuation
lines properly reflects operator precedence).
Tested for x86_64, and with build-many-glibcs.py.
* benchtests/bench-memmem.c (simple_memmem): Break lines before
rather than after operators.
* benchtests/bench-skeleton.c (TIMESPEC_AFTER): Likewise.
* crypt/md5.c (md5_finish_ctx): Likewise.
* crypt/sha256.c (__sha256_finish_ctx): Likewise.
* crypt/sha512.c (__sha512_finish_ctx): Likewise.
* elf/cache.c (load_aux_cache): Likewise.
* elf/dl-load.c (open_verify): Likewise.
* elf/get-dynamic-info.h (elf_get_dynamic_info): Likewise.
* elf/readelflib.c (process_elf_file): Likewise.
* elf/rtld.c (dl_main): Likewise.
* elf/sprof.c (generate_call_graph): Likewise.
* hurd/ctty-input.c (_hurd_ctty_input): Likewise.
* hurd/ctty-output.c (_hurd_ctty_output): Likewise.
* hurd/dtable.c (reauth_dtable): Likewise.
* hurd/getdport.c (__getdport): Likewise.
* hurd/hurd/signal.h (_hurd_interrupted_rpc_timeout): Likewise.
* hurd/hurd/sigpreempt.h (HURD_PREEMPT_SIGNAL_P): Likewise.
* hurd/hurdfault.c (_hurdsig_fault_catch_exception_raise):
Likewise.
* hurd/hurdioctl.c (fioctl): Likewise.
* hurd/hurdselect.c (_hurd_select): Likewise.
* hurd/hurdsig.c (_hurdsig_abort_rpcs): Likewise.
(STOPSIGS): Likewise.
* hurd/hurdstartup.c (_hurd_startup): Likewise.
* hurd/intr-msg.c (_hurd_intr_rpc_mach_msg): Likewise.
* hurd/lookup-retry.c (__hurd_file_name_lookup_retry): Likewise.
* hurd/msgportdemux.c (msgport_server): Likewise.
* hurd/setauth.c (_hurd_setauth): Likewise.
* include/features.h (__GLIBC_USE_DEPRECATED_SCANF): Likewise.
* libio/libioP.h [IO_DEBUG] (CHECK_FILE): Likewise.
* locale/programs/ld-ctype.c (set_class_defaults): Likewise.
* localedata/tests-mbwc/tst_swscanf.c (tst_swscanf): Likewise.
* login/tst-utmp.c (do_check): Likewise.
(simulate_login): Likewise.
* mach/lowlevellock.h (lll_lock): Likewise.
(lll_trylock): Likewise.
* math/test-fenv.c (ALL_EXC): Likewise.
* math/test-fenvinline.c (ALL_EXC): Likewise.
* misc/sys/cdefs.h (__attribute_deprecated_msg__): Likewise.
* nis/nis_call.c (__do_niscall3): Likewise.
* nis/nis_callback.c (cb_prog_1): Likewise.
* nis/nis_defaults.c (searchaccess): Likewise.
* nis/nis_findserv.c (__nis_findfastest_with_timeout): Likewise.
* nis/nis_ismember.c (internal_ismember): Likewise.
* nis/nis_local_names.c (nis_local_principal): Likewise.
* nis/nss_nis/nis-rpc.c (_nss_nis_getrpcbyname_r): Likewise.
* nis/nss_nisplus/nisplus-netgrp.c (_nss_nisplus_getnetgrent_r):
Likewise.
* nis/ypclnt.c (yp_match): Likewise.
(yp_first): Likewise.
(yp_next): Likewise.
(yp_master): Likewise.
(yp_order): Likewise.
* nscd/hstcache.c (cache_addhst): Likewise.
* nscd/initgrcache.c (addinitgroupsX): Likewise.
* nss/nss_compat/compat-pwd.c (copy_pwd_changes): Likewise.
(internal_getpwuid_r): Likewise.
* nss/nss_compat/compat-spwd.c (copy_spwd_changes): Likewise.
* posix/glob.h (__GLOB_FLAGS): Likewise.
* posix/regcomp.c (peek_token): Likewise.
(peek_token_bracket): Likewise.
(parse_expression): Likewise.
* posix/regexec.c (sift_states_iter_mb): Likewise.
(check_node_accept_bytes): Likewise.
* posix/tst-spawn3.c (do_test): Likewise.
* posix/wordexp-test.c (testit): Likewise.
* posix/wordexp.c (parse_tilde): Likewise.
(exec_comm): Likewise.
* posix/wordexp.h (__WRDE_FLAGS): Likewise.
* resource/vtimes.c (TIMEVAL_TO_VTIMES): Likewise.
* setjmp/sigjmp.c (__sigjmp_save): Likewise.
* stdio-common/printf_fp.c (__printf_fp_l): Likewise.
* stdio-common/tst-fileno.c (do_test): Likewise.
* stdio-common/vfprintf-internal.c (vfprintf): Likewise.
* stdlib/strfmon_l.c (__vstrfmon_l_internal): Likewise.
* stdlib/strtod_l.c (round_and_return): Likewise.
(____STRTOF_INTERNAL): Likewise.
* stdlib/tst-strfrom.h (TEST_STRFROM): Likewise.
* string/strcspn.c (STRCSPN): Likewise.
* string/test-memmem.c (simple_memmem): Likewise.
* termios/tcsetattr.c (tcsetattr): Likewise.
* time/alt_digit.c (_nl_parse_alt_digit): Likewise.
* time/asctime.c (asctime_internal): Likewise.
* time/strptime_l.c (__strptime_internal): Likewise.
* time/sys/time.h (timercmp): Likewise.
* time/tzfile.c (__tzfile_compute): Likewise.
2019-02-22 01:32:36 +00:00
|
|
|
+ aux_cache->len_strings))
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
{
|
2021-05-18 03:38:41 +00:00
|
|
|
if (aux_cache != MAP_FAILED)
|
|
|
|
munmap (aux_cache, aux_cache_size);
|
|
|
|
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
close (fd);
|
|
|
|
init_aux_cache ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
aux_hash_size = nextprime (aux_cache->nlibs);
|
|
|
|
aux_hash = xcalloc (aux_hash_size, sizeof (struct aux_cache_entry *));
|
|
|
|
|
|
|
|
const char *aux_cache_data
|
|
|
|
= (const char *) &aux_cache->libs[aux_cache->nlibs];
|
|
|
|
for (unsigned int i = 0; i < aux_cache->nlibs; ++i)
|
|
|
|
insert_to_aux_cache (&aux_cache->libs[i].id,
|
|
|
|
aux_cache->libs[i].flags,
|
|
|
|
aux_cache->libs[i].osversion,
|
2020-12-05 15:01:58 +00:00
|
|
|
aux_cache->libs[i].isa_level,
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
aux_cache->libs[i].soname == 0
|
|
|
|
? NULL : aux_cache_data + aux_cache->libs[i].soname,
|
|
|
|
0);
|
|
|
|
|
|
|
|
munmap (aux_cache, aux_cache_size);
|
|
|
|
close (fd);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Save the contents of the auxiliary cache. */
|
|
|
|
void
|
|
|
|
save_aux_cache (const char *aux_cache_name)
|
|
|
|
{
|
|
|
|
/* Count the length of all sonames. We start with empty string. */
|
|
|
|
size_t total_strlen = 1;
|
|
|
|
/* Number of cache entries. */
|
|
|
|
int cache_entry_count = 0;
|
|
|
|
|
|
|
|
for (size_t i = 0; i < aux_hash_size; ++i)
|
|
|
|
for (struct aux_cache_entry *entry = aux_hash[i];
|
|
|
|
entry != NULL; entry = entry->next)
|
|
|
|
if (entry->used)
|
|
|
|
{
|
|
|
|
++cache_entry_count;
|
|
|
|
if (entry->soname != NULL)
|
|
|
|
total_strlen += strlen (entry->soname) + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Auxiliary cache. */
|
|
|
|
size_t file_entries_size
|
|
|
|
= sizeof (struct aux_cache_file)
|
|
|
|
+ cache_entry_count * sizeof (struct aux_cache_file_entry);
|
|
|
|
struct aux_cache_file *file_entries
|
|
|
|
= xmalloc (file_entries_size + total_strlen);
|
|
|
|
|
|
|
|
/* Fill in the header of the auxiliary cache. */
|
|
|
|
memset (file_entries, '\0', sizeof (struct aux_cache_file));
|
|
|
|
memcpy (file_entries->magic, AUX_CACHEMAGIC, sizeof AUX_CACHEMAGIC - 1);
|
|
|
|
|
|
|
|
file_entries->nlibs = cache_entry_count;
|
|
|
|
file_entries->len_strings = total_strlen;
|
|
|
|
|
|
|
|
/* Initial String offset for auxiliary cache is always after the
|
|
|
|
special empty string. */
|
|
|
|
unsigned int str_offset = 1;
|
|
|
|
|
|
|
|
/* An array for all strings. */
|
|
|
|
char *str = (char *) file_entries + file_entries_size;
|
|
|
|
*str++ = '\0';
|
|
|
|
|
|
|
|
size_t idx = 0;
|
|
|
|
for (size_t i = 0; i < aux_hash_size; ++i)
|
|
|
|
for (struct aux_cache_entry *entry = aux_hash[i];
|
|
|
|
entry != NULL; entry = entry->next)
|
|
|
|
if (entry->used)
|
|
|
|
{
|
|
|
|
file_entries->libs[idx].id = entry->id;
|
|
|
|
file_entries->libs[idx].flags = entry->flags;
|
|
|
|
if (entry->soname == NULL)
|
|
|
|
file_entries->libs[idx].soname = 0;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
file_entries->libs[idx].soname = str_offset;
|
|
|
|
|
|
|
|
size_t len = strlen (entry->soname) + 1;
|
|
|
|
str = mempcpy (str, entry->soname, len);
|
|
|
|
str_offset += len;
|
|
|
|
}
|
|
|
|
file_entries->libs[idx].osversion = entry->osversion;
|
2020-12-05 15:01:58 +00:00
|
|
|
file_entries->libs[idx++].isa_level = entry->isa_level;
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Write out auxiliary cache file. */
|
|
|
|
/* Write auxiliary cache first to a temporary file and rename it later. */
|
|
|
|
|
|
|
|
char *temp_name = xmalloc (strlen (aux_cache_name) + 2);
|
|
|
|
sprintf (temp_name, "%s~", aux_cache_name);
|
|
|
|
|
|
|
|
/* Check that directory exists and create if needed. */
|
|
|
|
char *dir = strdupa (aux_cache_name);
|
|
|
|
dir = dirname (dir);
|
|
|
|
|
2021-12-29 13:20:46 +00:00
|
|
|
struct stat st;
|
|
|
|
if (stat (dir, &st) < 0)
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
{
|
|
|
|
if (mkdir (dir, 0700) < 0)
|
|
|
|
goto out_fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Create file. */
|
|
|
|
int fd = open (temp_name, O_CREAT|O_WRONLY|O_TRUNC|O_NOFOLLOW,
|
|
|
|
S_IRUSR|S_IWUSR);
|
|
|
|
if (fd < 0)
|
|
|
|
goto out_fail;
|
|
|
|
|
2021-05-18 03:38:41 +00:00
|
|
|
bool fail = ((write (fd, file_entries, file_entries_size + total_strlen)
|
|
|
|
!= (ssize_t) (file_entries_size + total_strlen))
|
|
|
|
|| fdatasync (fd) != 0);
|
|
|
|
|
|
|
|
fail |= close (fd) != 0;
|
|
|
|
|
|
|
|
if (fail)
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
{
|
|
|
|
unlink (temp_name);
|
|
|
|
goto out_fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Move temporary to its final location. */
|
|
|
|
if (rename (temp_name, aux_cache_name))
|
|
|
|
unlink (temp_name);
|
|
|
|
|
|
|
|
out_fail:
|
|
|
|
/* Free allocated memory. */
|
2007-10-13 05:21:59 +00:00
|
|
|
free (temp_name);
|
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (opt_ignore_aux_cache): Add new option.
(options): Add option.
(parse_opt): Handle option.
(manual_link): Adjust process_file caller. Call implicit_soname.
(search_dir): Formatting. Use and populate auxiliary cache.
(main): Load and save auxiliary cache.
* elf/readlib.c (process_file): Add stat_buf argument. Pass struct
stat64 from fstat64 to caller.
(implicit_soname): New function.
* elf/readelflib.c (process_elf_file): If DT_SONAME is not present,
leave *soname as NULL.
* elf/cache.c: Include libgen.h.
(print_entry, print_cache, compare, save_cache, add_to_cache):
Formatting and cleanups.
(aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry,
aux_cache_file): New structures.
(AUX_CACHEMAGIC): Define.
(primes): New array.
(aux_hash_size, aux_hash): New variables.
(aux_cache_entry_id_hash, nextprime, init_aux_cache,
search_aux_cache, insert_to_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache): New functions.
* sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define.
(init_aux_cache, search_aux_cache, add_to_aux_cache,
load_aux_cache, save_aux_cache, implicit_soname): New prototypes.
(process_file): Adjust prototype.
2007-08-12 20:09:16 +00:00
|
|
|
free (file_entries);
|
|
|
|
}
|