Blame sysdeps/generic/dl-cache.h

Packit Service 82fcde
/* Support for reading /etc/ld.so.cache files written by Linux ldconfig.
Packit Service 82fcde
   Copyright (C) 1999-2018 Free Software Foundation, Inc.
Packit Service 82fcde
   This file is part of the GNU C Library.
Packit Service 82fcde
Packit Service 82fcde
   The GNU C Library is free software; you can redistribute it and/or
Packit Service 82fcde
   modify it under the terms of the GNU Lesser General Public
Packit Service 82fcde
   License as published by the Free Software Foundation; either
Packit Service 82fcde
   version 2.1 of the License, or (at your option) any later version.
Packit Service 82fcde
Packit Service 82fcde
   The GNU C Library is distributed in the hope that it will be useful,
Packit Service 82fcde
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 82fcde
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 82fcde
   Lesser General Public License for more details.
Packit Service 82fcde
Packit Service 82fcde
   You should have received a copy of the GNU Lesser General Public
Packit Service 82fcde
   License along with the GNU C Library; if not, see
Packit Service 82fcde
   <http://www.gnu.org/licenses/>.  */
Packit Service 82fcde
Packit Service 82fcde
#include <stdint.h>
Packit Service 82fcde
Packit Service 82fcde
#ifndef _DL_CACHE_DEFAULT_ID
Packit Service 82fcde
# define _DL_CACHE_DEFAULT_ID	3
Packit Service 82fcde
#endif
Packit Service 82fcde
Packit Service 82fcde
#ifndef _dl_cache_check_flags
Packit Service 82fcde
# define _dl_cache_check_flags(flags)			\
Packit Service 82fcde
  ((flags) == 1 || (flags) == _DL_CACHE_DEFAULT_ID)
Packit Service 82fcde
#endif
Packit Service 82fcde
Packit Service 82fcde
#ifndef LD_SO_CACHE
Packit Service 82fcde
# define LD_SO_CACHE SYSCONFDIR "/ld.so.cache"
Packit Service 82fcde
#endif
Packit Service 82fcde
Packit Service 82fcde
#ifndef add_system_dir
Packit Service 82fcde
# define add_system_dir(dir) add_dir (dir)
Packit Service 82fcde
#endif
Packit Service 82fcde
Packit Service 82fcde
#define CACHEMAGIC "ld.so-1.7.0"
Packit Service 82fcde
Packit Service 82fcde
/* libc5 and glibc 2.0/2.1 use the same format.  For glibc 2.2 another
Packit Service 82fcde
   format has been added in a compatible way:
Packit Service 82fcde
   The beginning of the string table is used for the new table:
Packit Service 82fcde
	old_magic
Packit Service 82fcde
	nlibs
Packit Service 82fcde
	libs[0]
Packit Service 82fcde
	...
Packit Service 82fcde
	libs[nlibs-1]
Packit Service 82fcde
	pad, new magic needs to be aligned
Packit Service 82fcde
	     - this is string[0] for the old format
Packit Service 82fcde
	new magic - this is string[0] for the new format
Packit Service 82fcde
	newnlibs
Packit Service 82fcde
	...
Packit Service 82fcde
	newlibs[0]
Packit Service 82fcde
	...
Packit Service 82fcde
	newlibs[newnlibs-1]
Packit Service 82fcde
	string 1
Packit Service 82fcde
	string 2
Packit Service 82fcde
	...
Packit Service 82fcde
*/
Packit Service 82fcde
struct file_entry
Packit Service 82fcde
{
Packit Service 82fcde
  int flags;		/* This is 1 for an ELF library.  */
Packit Service 82fcde
  unsigned int key, value; /* String table indices.  */
Packit Service 82fcde
};
Packit Service 82fcde
Packit Service 82fcde
struct cache_file
Packit Service 82fcde
{
Packit Service 82fcde
  char magic[sizeof CACHEMAGIC - 1];
Packit Service 82fcde
  unsigned int nlibs;
Packit Service 82fcde
  struct file_entry libs[0];
Packit Service 82fcde
};
Packit Service 82fcde
Packit Service 82fcde
#define CACHEMAGIC_NEW "glibc-ld.so.cache"
Packit Service 82fcde
#define CACHE_VERSION "1.1"
Packit Service 82fcde
#define CACHEMAGIC_VERSION_NEW CACHEMAGIC_NEW CACHE_VERSION
Packit Service 82fcde
Packit Service 82fcde
Packit Service 82fcde
struct file_entry_new
Packit Service 82fcde
{
Packit Service 82fcde
  int32_t flags;		/* This is 1 for an ELF library.  */
Packit Service 82fcde
  uint32_t key, value;		/* String table indices.  */
Packit Service 82fcde
  uint32_t osversion;		/* Required OS version.	 */
Packit Service 82fcde
  uint64_t hwcap;		/* Hwcap entry.	 */
Packit Service 82fcde
};
Packit Service 82fcde
Packit Service 82fcde
struct cache_file_new
Packit Service 82fcde
{
Packit Service 82fcde
  char magic[sizeof CACHEMAGIC_NEW - 1];
Packit Service 82fcde
  char version[sizeof CACHE_VERSION - 1];
Packit Service 82fcde
  uint32_t nlibs;		/* Number of entries.  */
Packit Service 82fcde
  uint32_t len_strings;		/* Size of string table. */
Packit Service 82fcde
  uint32_t unused[5];		/* Leave space for future extensions
Packit Service 82fcde
				   and align to 8 byte boundary.  */
Packit Service 82fcde
  struct file_entry_new libs[0]; /* Entries describing libraries.  */
Packit Service 82fcde
  /* After this the string table of size len_strings is found.	*/
Packit Service 82fcde
};
Packit Service 82fcde
Packit Service 82fcde
/* Used to align cache_file_new.  */
Packit Service 82fcde
#define ALIGN_CACHE(addr)				\
Packit Service 82fcde
(((addr) + __alignof__ (struct cache_file_new) -1)	\
Packit Service 82fcde
 & (~(__alignof__ (struct cache_file_new) - 1)))
Packit Service 82fcde
Packit Service 82fcde
extern int _dl_cache_libcmp (const char *p1, const char *p2) attribute_hidden;