Blame sysdeps/generic/ldsodefs.h

Packit 6c4009
/* Run-time dynamic linker data structures for loaded ELF shared objects.
Packit 6c4009
   Copyright (C) 1995-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
#ifndef	_LDSODEFS_H
Packit 6c4009
#define	_LDSODEFS_H	1
Packit 6c4009
Packit 6c4009
#include <features.h>
Packit 6c4009
Packit 6c4009
#include <stdbool.h>
Packit 6c4009
#define __need_size_t
Packit 6c4009
#define __need_NULL
Packit 6c4009
#include <stddef.h>
Packit 6c4009
#include <string.h>
Packit 6c4009
#include <stdint.h>
Packit 6c4009
Packit 6c4009
#include <elf.h>
Packit 6c4009
#include <dlfcn.h>
Packit 6c4009
#include <fpu_control.h>
Packit 6c4009
#include <sys/mman.h>
Packit 6c4009
#include <link.h>
Packit 6c4009
#include <dl-lookupcfg.h>
Packit 6c4009
#include <dl-sysdep.h>
Packit 6c4009
#include <libc-lock.h>
Packit 6c4009
#include <hp-timing.h>
Packit 6c4009
#include <tls.h>
Packit 6c4009
Packit 6c4009
__BEGIN_DECLS
Packit 6c4009
Packit 6c4009
#define VERSYMIDX(sym)	(DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (sym))
Packit 6c4009
#define VALIDX(tag)	(DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM \
Packit 6c4009
			 + DT_EXTRANUM + DT_VALTAGIDX (tag))
Packit 6c4009
#define ADDRIDX(tag)	(DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM \
Packit 6c4009
			 + DT_EXTRANUM + DT_VALNUM + DT_ADDRTAGIDX (tag))
Packit 6c4009
Packit Service 2d4af7
/* Type of GNU hash which the machine uses.  */
Packit Service 2d4af7
#ifndef ELF_MACHINE_GNU_HASH_ADDRIDX
Packit Service 2d4af7
# define ELF_MACHINE_GNU_HASH_ADDRIDX ADDRIDX (DT_GNU_HASH)
Packit Service 2d4af7
#endif
Packit Service 2d4af7
Packit Service 2d4af7
/* Calculate the index of a symbol in GNU hash.  */
Packit Service 2d4af7
#ifndef ELF_MACHINE_HASH_SYMIDX
Packit Service 2d4af7
# define ELF_MACHINE_HASH_SYMIDX(map, hasharr) \
Packit Service 2d4af7
  ((hasharr) - (map)->l_gnu_chain_zero)
Packit Service 2d4af7
#endif
Packit Service 2d4af7
Packit Service 2d4af7
/* Setup MIPS xhash.  Defined only for MIPS.  */
Packit Service 2d4af7
#ifndef ELF_MACHINE_XHASH_SETUP
Packit Service 2d4af7
# define ELF_MACHINE_XHASH_SETUP(hash32, symbias, map) \
Packit Service 2d4af7
  ((void) (hash32), (void) (symbias), (void) (map))
Packit Service 2d4af7
#endif
Packit Service 2d4af7
Packit 6c4009
/* We use this macro to refer to ELF types independent of the native wordsize.
Packit 6c4009
   `ElfW(TYPE)' is used in place of `Elf32_TYPE' or `Elf64_TYPE'.  */
Packit 6c4009
#define ELFW(type)	_ElfW (ELF, __ELF_NATIVE_CLASS, type)
Packit 6c4009
Packit 6c4009
/* All references to the value of l_info[DT_PLTGOT],
Packit 6c4009
  l_info[DT_STRTAB], l_info[DT_SYMTAB], l_info[DT_RELA],
Packit 6c4009
  l_info[DT_REL], l_info[DT_JMPREL], and l_info[VERSYMIDX (DT_VERSYM)]
Packit 6c4009
  have to be accessed via the D_PTR macro.  The macro is needed since for
Packit 6c4009
  most architectures the entry is already relocated - but for some not
Packit 6c4009
  and we need to relocate at access time.  */
Packit 6c4009
#ifdef DL_RO_DYN_SECTION
Packit 6c4009
# define D_PTR(map, i) ((map)->i->d_un.d_ptr + (map)->l_addr)
Packit 6c4009
#else
Packit 6c4009
# define D_PTR(map, i) (map)->i->d_un.d_ptr
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Result of the lookup functions and how to retrieve the base address.  */
Packit 6c4009
typedef struct link_map *lookup_t;
Packit 6c4009
#define LOOKUP_VALUE(map) map
Packit 6c4009
#define LOOKUP_VALUE_ADDRESS(map, set) ((set) || (map) ? (map)->l_addr : 0)
Packit 6c4009
Packit 6c4009
/* Calculate the address of symbol REF using the base address from map MAP,
Packit 6c4009
   if non-NULL.  Don't check for NULL map if MAP_SET is TRUE.  */
Packit 6c4009
#define SYMBOL_ADDRESS(map, ref, map_set)				\
Packit 6c4009
  ((ref) == NULL ? 0							\
Packit 6c4009
   : (__glibc_unlikely ((ref)->st_shndx == SHN_ABS) ? 0			\
Packit 6c4009
      : LOOKUP_VALUE_ADDRESS (map, map_set)) + (ref)->st_value)
Packit 6c4009
Packit 6c4009
/* On some architectures a pointer to a function is not just a pointer
Packit 6c4009
   to the actual code of the function but rather an architecture
Packit 6c4009
   specific descriptor. */
Packit 6c4009
#ifndef ELF_FUNCTION_PTR_IS_SPECIAL
Packit 6c4009
# define DL_SYMBOL_ADDRESS(map, ref) \
Packit 6c4009
 (void *) SYMBOL_ADDRESS (map, ref, false)
Packit 6c4009
# define DL_LOOKUP_ADDRESS(addr) ((ElfW(Addr)) (addr))
Packit 6c4009
# define DL_CALL_DT_INIT(map, start, argc, argv, env) \
Packit 6c4009
 ((init_t) (start)) (argc, argv, env)
Packit 6c4009
# define DL_CALL_DT_FINI(map, start) ((fini_t) (start)) ()
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* On some architectures dladdr can't use st_size of all symbols this way.  */
Packit 6c4009
#define DL_ADDR_SYM_MATCH(L, SYM, MATCHSYM, ADDR) \
Packit 6c4009
  ((ADDR) >= (L)->l_addr + (SYM)->st_value				\
Packit 6c4009
   && ((((SYM)->st_shndx == SHN_UNDEF || (SYM)->st_size == 0)		\
Packit 6c4009
	&& (ADDR) == (L)->l_addr + (SYM)->st_value)			\
Packit 6c4009
       || (ADDR) < (L)->l_addr + (SYM)->st_value + (SYM)->st_size)	\
Packit 6c4009
   && ((MATCHSYM) == NULL || (MATCHSYM)->st_value < (SYM)->st_value))
Packit 6c4009
Packit 6c4009
/* According to the ELF gABI no STV_HIDDEN or STV_INTERNAL symbols are
Packit 6c4009
   expected to be present in dynamic symbol tables as they should have
Packit 6c4009
   been either removed or converted to STB_LOCAL binding by the static
Packit 6c4009
   linker.  However some GNU binutils versions produce such symbols in
Packit 6c4009
   some cases.  To prevent such symbols present in a buggy binary from
Packit 6c4009
   preempting global symbols we filter them out with this predicate.  */
Packit 6c4009
static __always_inline bool
Packit 6c4009
dl_symbol_visibility_binds_local_p (const ElfW(Sym) *sym)
Packit 6c4009
{
Packit 6c4009
  return (ELFW(ST_VISIBILITY) (sym->st_other) == STV_HIDDEN
Packit 6c4009
	  || ELFW(ST_VISIBILITY) (sym->st_other) == STV_INTERNAL);
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
/* Unmap a loaded object, called by _dl_close (). */
Packit 6c4009
#ifndef DL_UNMAP_IS_SPECIAL
Packit 6c4009
# define DL_UNMAP(map)	_dl_unmap_segments (map)
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* By default we do not need special support to initialize DSOs loaded
Packit 6c4009
   by statically linked binaries.  */
Packit 6c4009
#ifndef DL_STATIC_INIT
Packit 6c4009
# define DL_STATIC_INIT(map)
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Reloc type classes as returned by elf_machine_type_class().
Packit 6c4009
   ELF_RTYPE_CLASS_PLT means this reloc should not be satisfied by
Packit 6c4009
   some PLT symbol, ELF_RTYPE_CLASS_COPY means this reloc should not be
Packit 6c4009
   satisfied by any symbol in the executable.  Some architectures do
Packit 6c4009
   not support copy relocations.  In this case we define the macro to
Packit 6c4009
   zero so that the code for handling them gets automatically optimized
Packit 6c4009
   out.  ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA means address of protected
Packit 6c4009
   data defined in the shared library may be external, i.e., due to copy
Packit 6c4009
   relocation.  */
Packit 6c4009
#define ELF_RTYPE_CLASS_PLT 1
Packit 6c4009
#ifndef DL_NO_COPY_RELOCS
Packit 6c4009
# define ELF_RTYPE_CLASS_COPY 2
Packit 6c4009
#else
Packit 6c4009
# define ELF_RTYPE_CLASS_COPY 0
Packit 6c4009
#endif
Packit 6c4009
/* If DL_EXTERN_PROTECTED_DATA is defined, address of protected data
Packit 6c4009
   defined in the shared library may be external, i.e., due to copy
Packit 6c4009
   relocation.   */
Packit 6c4009
#ifdef DL_EXTERN_PROTECTED_DATA
Packit 6c4009
# define ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA 4
Packit 6c4009
#else
Packit 6c4009
# define ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA 0
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* ELF uses the PF_x macros to specify the segment permissions, mmap
Packit 6c4009
   uses PROT_xxx.  In most cases the three macros have the values 1, 2,
Packit 6c4009
   and 3 but not in a matching order.  The following macros allows
Packit 6c4009
   converting from the PF_x values to PROT_xxx values.  */
Packit 6c4009
#define PF_TO_PROT \
Packit 6c4009
  ((PROT_READ << (PF_R * 4))						      \
Packit 6c4009
   | (PROT_WRITE << (PF_W * 4))						      \
Packit 6c4009
   | (PROT_EXEC << (PF_X * 4))						      \
Packit 6c4009
   | ((PROT_READ | PROT_WRITE) << ((PF_R | PF_W) * 4))			      \
Packit 6c4009
   | ((PROT_READ | PROT_EXEC) << ((PF_R | PF_X) * 4))			      \
Packit 6c4009
   | ((PROT_WRITE | PROT_EXEC) << (PF_W | PF_X) * 4)			      \
Packit 6c4009
   | ((PROT_READ | PROT_WRITE | PROT_EXEC) << ((PF_R | PF_W | PF_X) * 4)))
Packit 6c4009
Packit 6c4009
/* The filename itself, or the main program name, if available.  */
Packit 6c4009
#define DSO_FILENAME(name) ((name)[0] ? (name)				      \
Packit 6c4009
			    : (rtld_progname ?: "<main program>"))
Packit 6c4009
Packit 6c4009
#define RTLD_PROGNAME (rtld_progname ?: "<program name unknown>")
Packit 6c4009
Packit 6c4009
/* For the version handling we need an array with only names and their
Packit 6c4009
   hash values.  */
Packit 6c4009
struct r_found_version
Packit 6c4009
  {
Packit 6c4009
    const char *name;
Packit 6c4009
    ElfW(Word) hash;
Packit 6c4009
Packit 6c4009
    int hidden;
Packit 6c4009
    const char *filename;
Packit 6c4009
  };
Packit 6c4009
Packit 6c4009
/* We want to cache information about the searches for shared objects.  */
Packit 6c4009
Packit 6c4009
enum r_dir_status { unknown, nonexisting, existing };
Packit 6c4009
Packit 6c4009
struct r_search_path_elem
Packit 6c4009
  {
Packit 6c4009
    /* This link is only used in the `all_dirs' member of `r_search_path'.  */
Packit 6c4009
    struct r_search_path_elem *next;
Packit 6c4009
Packit 6c4009
    /* Strings saying where the definition came from.  */
Packit 6c4009
    const char *what;
Packit 6c4009
    const char *where;
Packit 6c4009
Packit 6c4009
    /* Basename for this search path element.  The string must end with
Packit 6c4009
       a slash character.  */
Packit 6c4009
    const char *dirname;
Packit 6c4009
    size_t dirnamelen;
Packit 6c4009
Packit 6c4009
    enum r_dir_status status[0];
Packit 6c4009
  };
Packit 6c4009
Packit 6c4009
struct r_strlenpair
Packit 6c4009
  {
Packit 6c4009
    const char *str;
Packit 6c4009
    size_t len;
Packit 6c4009
  };
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* A data structure for a simple single linked list of strings.  */
Packit 6c4009
struct libname_list
Packit 6c4009
  {
Packit 6c4009
    const char *name;		/* Name requested (before search).  */
Packit 6c4009
    struct libname_list *next;	/* Link to next name for this object.  */
Packit 6c4009
    int dont_free;		/* Flag whether this element should be freed
Packit 6c4009
				   if the object is not entirely unloaded.  */
Packit 6c4009
  };
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Bit masks for the objects which valid callers can come from to
Packit 6c4009
   functions with restricted interface.  */
Packit 6c4009
enum allowmask
Packit 6c4009
  {
Packit 6c4009
    allow_libc = 1,
Packit 6c4009
    allow_libdl = 2,
Packit 6c4009
    allow_libpthread = 4,
Packit 6c4009
    allow_ldso = 8
Packit 6c4009
  };
Packit 6c4009
Packit 6c4009
Packit 6c4009
struct audit_ifaces
Packit 6c4009
{
Packit 6c4009
  void (*activity) (uintptr_t *, unsigned int);
Packit 6c4009
  char *(*objsearch) (const char *, uintptr_t *, unsigned int);
Packit 6c4009
  unsigned int (*objopen) (struct link_map *, Lmid_t, uintptr_t *);
Packit 6c4009
  void (*preinit) (uintptr_t *);
Packit 6c4009
  union
Packit 6c4009
  {
Packit 6c4009
    uintptr_t (*symbind32) (Elf32_Sym *, unsigned int, uintptr_t *,
Packit 6c4009
			    uintptr_t *, unsigned int *, const char *);
Packit 6c4009
    uintptr_t (*symbind64) (Elf64_Sym *, unsigned int, uintptr_t *,
Packit 6c4009
			    uintptr_t *, unsigned int *, const char *);
Packit 6c4009
  };
Packit 6c4009
  union
Packit 6c4009
  {
Packit 6c4009
#ifdef ARCH_PLTENTER_MEMBERS
Packit 6c4009
    ARCH_PLTENTER_MEMBERS;
Packit 6c4009
#endif
Packit 6c4009
  };
Packit 6c4009
  union
Packit 6c4009
  {
Packit 6c4009
#ifdef ARCH_PLTEXIT_MEMBERS
Packit 6c4009
    ARCH_PLTEXIT_MEMBERS;
Packit 6c4009
#endif
Packit 6c4009
  };
Packit 6c4009
  unsigned int (*objclose) (uintptr_t *);
Packit 6c4009
Packit 6c4009
  struct audit_ifaces *next;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Test whether given NAME matches any of the names of the given object.  */
Packit 6c4009
extern int _dl_name_match_p (const char *__name, const struct link_map *__map)
Packit 6c4009
     attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Compute next higher prime number.  */
Packit 6c4009
extern unsigned long int _dl_higher_prime_number (unsigned long int n)
Packit 6c4009
     attribute_hidden;
Packit 6c4009
Packit 6c4009
/* A stripped down strtoul-like implementation.  */
Packit 6c4009
uint64_t _dl_strtoul (const char *, char **) attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Function used as argument for `_dl_receive_error' function.  The
Packit 6c4009
   arguments are the error code, error string, and the objname the
Packit 6c4009
   error occurred in.  */
Packit 6c4009
typedef void (*receiver_fct) (int, const char *, const char *);
Packit 6c4009

Packit 6c4009
/* Internal functions of the run-time dynamic linker.
Packit 6c4009
   These can be accessed if you link again the dynamic linker
Packit 6c4009
   as a shared library, as in `-lld' or `/lib/ld.so' explicitly;
Packit 6c4009
   but are not normally of interest to user programs.
Packit 6c4009
Packit 6c4009
   The `-ldl' library functions in <dlfcn.h> provide a simple
Packit 6c4009
   user interface to run-time dynamic linking.  */
Packit 6c4009
Packit 6c4009
Packit 6c4009
#ifndef SHARED
Packit 6c4009
# define EXTERN extern
Packit 6c4009
# define GL(name) _##name
Packit 6c4009
#else
Packit 6c4009
# define EXTERN
Packit 6c4009
# if IS_IN (rtld)
Packit 6c4009
#  define GL(name) _rtld_local._##name
Packit 6c4009
# else
Packit 6c4009
#  define GL(name) _rtld_global._##name
Packit 6c4009
# endif
Packit 6c4009
struct rtld_global
Packit 6c4009
{
Packit 6c4009
#endif
Packit 6c4009
  /* Don't change the order of the following elements.  'dl_loaded'
Packit 6c4009
     must remain the first element.  Forever.  */
Packit 6c4009
Packit 6c4009
/* Non-shared code has no support for multiple namespaces.  */
Packit 6c4009
#ifdef SHARED
Packit 6c4009
# define DL_NNS 16
Packit 6c4009
#else
Packit 6c4009
# define DL_NNS 1
Packit 6c4009
#endif
Packit 6c4009
  EXTERN struct link_namespaces
Packit 6c4009
  {
Packit 6c4009
    /* A pointer to the map for the main map.  */
Packit 6c4009
    struct link_map *_ns_loaded;
Packit 6c4009
    /* Number of object in the _dl_loaded list.  */
Packit 6c4009
    unsigned int _ns_nloaded;
Packit 6c4009
    /* Direct pointer to the searchlist of the main object.  */
Packit 6c4009
    struct r_scope_elem *_ns_main_searchlist;
Packit 6c4009
    /* This is zero at program start to signal that the global scope map is
Packit 6c4009
       allocated by rtld.  Later it keeps the size of the map.  It might be
Packit 6c4009
       reset if in _dl_close if the last global object is removed.  */
Packit Service 7e8d4d
    unsigned int _ns_global_scope_alloc;
Packit Service 7e8d4d
Packit Service 7e8d4d
    /* During dlopen, this is the number of objects that still need to
Packit Service 7e8d4d
       be added to the global scope map.  It has to be taken into
Packit Service 7e8d4d
       account when resizing the map, for future map additions after
Packit Service 7e8d4d
       recursive dlopen calls from ELF constructors.  */
Packit Service 7e8d4d
    unsigned int _ns_global_scope_pending_adds;
Packit Service 7e8d4d
Packit Service 11a55a
    /* Once libc.so has been loaded into the namespace, this points to
Packit Service 11a55a
       its link map.  */
Packit Service 11a55a
    struct link_map *libc_map;
Packit Service 11a55a
Packit 6c4009
    /* Search table for unique objects.  */
Packit 6c4009
    struct unique_sym_table
Packit 6c4009
    {
Packit 6c4009
      __rtld_lock_define_recursive (, lock)
Packit 6c4009
      struct unique_sym
Packit 6c4009
      {
Packit 6c4009
	uint32_t hashval;
Packit 6c4009
	const char *name;
Packit 6c4009
	const ElfW(Sym) *sym;
Packit 6c4009
	const struct link_map *map;
Packit 6c4009
      } *entries;
Packit 6c4009
      size_t size;
Packit 6c4009
      size_t n_elements;
Packit 6c4009
      void (*free) (void *);
Packit 6c4009
    } _ns_unique_sym_table;
Packit 6c4009
    /* Keep track of changes to each namespace' list.  */
Packit 6c4009
    struct r_debug _ns_debug;
Packit 6c4009
  } _dl_ns[DL_NNS];
Packit 6c4009
  /* One higher than index of last used namespace.  */
Packit 6c4009
  EXTERN size_t _dl_nns;
Packit 6c4009
Packit 6c4009
  /* During the program run we must not modify the global data of
Packit 6c4009
     loaded shared object simultanously in two threads.  Therefore we
Packit 6c4009
     protect `_dl_open' and `_dl_close' in dl-close.c.
Packit 6c4009
Packit 6c4009
     This must be a recursive lock since the initializer function of
Packit 6c4009
     the loaded object might as well require a call to this function.
Packit 6c4009
     At this time it is not anymore a problem to modify the tables.  */
Packit 6c4009
  __rtld_lock_define_recursive (EXTERN, _dl_load_lock)
Packit 6c4009
  /* This lock is used to keep __dl_iterate_phdr from inspecting the
Packit 6c4009
     list of loaded objects while an object is added to or removed
Packit 6c4009
     from that list.  */
Packit 6c4009
  __rtld_lock_define_recursive (EXTERN, _dl_load_write_lock)
Packit 6c4009
Packit 6c4009
  /* Incremented whenever something may have been added to dl_loaded.  */
Packit 6c4009
  EXTERN unsigned long long _dl_load_adds;
Packit 6c4009
Packit 6c4009
  /* The object to be initialized first.  */
Packit 6c4009
  EXTERN struct link_map *_dl_initfirst;
Packit 6c4009
Packit 6c4009
  /* Map of shared object to be profiled.  */
Packit 6c4009
  EXTERN struct link_map *_dl_profile_map;
Packit 6c4009
Packit 6c4009
  /* Counters for the number of relocations performed.  */
Packit 6c4009
  EXTERN unsigned long int _dl_num_relocations;
Packit 6c4009
  EXTERN unsigned long int _dl_num_cache_relocations;
Packit 6c4009
Packit 6c4009
  /* List of search directories.  */
Packit 6c4009
  EXTERN struct r_search_path_elem *_dl_all_dirs;
Packit 6c4009
Packit 6c4009
  /* Structure describing the dynamic linker itself.  We need to
Packit 6c4009
     reserve memory for the data the audit libraries need.  */
Packit 6c4009
  EXTERN struct link_map _dl_rtld_map;
Packit 6c4009
#ifdef SHARED
Packit 6c4009
  struct auditstate audit_data[DL_NNS];
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#if defined SHARED && defined _LIBC_REENTRANT \
Packit 6c4009
    && defined __rtld_lock_default_lock_recursive
Packit 6c4009
  EXTERN void (*_dl_rtld_lock_recursive) (void *);
Packit 6c4009
  EXTERN void (*_dl_rtld_unlock_recursive) (void *);
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
  /* Get architecture specific definitions.  */
Packit 6c4009
#define PROCINFO_DECL
Packit 6c4009
#ifndef PROCINFO_CLASS
Packit 6c4009
# define PROCINFO_CLASS EXTERN
Packit 6c4009
#endif
Packit 6c4009
#include <dl-procruntime.c>
Packit 6c4009
Packit 6c4009
  /* If loading a shared object requires that we make the stack executable
Packit 6c4009
     when it was not, we do it by calling this function.
Packit 6c4009
     It returns an errno code or zero on success.  */
Packit 6c4009
  EXTERN int (*_dl_make_stack_executable_hook) (void **);
Packit 6c4009
Packit 6c4009
  /* Prevailing state of the stack, PF_X indicating it's executable.  */
Packit 6c4009
  EXTERN ElfW(Word) _dl_stack_flags;
Packit 6c4009
Packit 6c4009
  /* Flag signalling whether there are gaps in the module ID allocation.  */
Packit 6c4009
  EXTERN bool _dl_tls_dtv_gaps;
Packit 6c4009
  /* Highest dtv index currently needed.  */
Packit 6c4009
  EXTERN size_t _dl_tls_max_dtv_idx;
Packit 6c4009
  /* Information about the dtv slots.  */
Packit 6c4009
  EXTERN struct dtv_slotinfo_list
Packit 6c4009
  {
Packit 6c4009
    size_t len;
Packit 6c4009
    struct dtv_slotinfo_list *next;
Packit 6c4009
    struct dtv_slotinfo
Packit 6c4009
    {
Packit 6c4009
      size_t gen;
Packit 6c4009
      struct link_map *map;
Packit 6c4009
    } slotinfo[0];
Packit 6c4009
  } *_dl_tls_dtv_slotinfo_list;
Packit 6c4009
  /* Number of modules in the static TLS block.  */
Packit 6c4009
  EXTERN size_t _dl_tls_static_nelem;
Packit 6c4009
  /* Size of the static TLS block.  */
Packit 6c4009
  EXTERN size_t _dl_tls_static_size;
Packit 6c4009
  /* Size actually allocated in the static TLS block.  */
Packit 6c4009
  EXTERN size_t _dl_tls_static_used;
Packit 6c4009
  /* Alignment requirement of the static TLS block.  */
Packit 6c4009
  EXTERN size_t _dl_tls_static_align;
Packit Service e79384
  /* Remaining amount of static TLS that may be used for optimizing
Packit Service e79384
     dynamic TLS access (e.g. with TLSDESC).  */
Packit Service e79384
  EXTERN size_t _dl_tls_static_optional;
Packit 6c4009
Packit 6c4009
/* Number of additional entries in the slotinfo array of each slotinfo
Packit 6c4009
   list element.  A large number makes it almost certain take we never
Packit 6c4009
   have to iterate beyond the first element in the slotinfo list.  */
Packit 6c4009
#define TLS_SLOTINFO_SURPLUS (62)
Packit 6c4009
Packit 6c4009
/* Number of additional slots in the dtv allocated.  */
Packit 6c4009
#define DTV_SURPLUS	(14)
Packit 6c4009
Packit 6c4009
  /* Initial dtv of the main thread, not allocated with normal malloc.  */
Packit 6c4009
  EXTERN void *_dl_initial_dtv;
Packit 6c4009
  /* Generation counter for the dtv.  */
Packit 6c4009
  EXTERN size_t _dl_tls_generation;
Packit 6c4009
Packit 6c4009
  EXTERN void (*_dl_init_static_tls) (struct link_map *);
Packit 6c4009
Packit 6c4009
  EXTERN void (*_dl_wait_lookup_done) (void);
Packit 6c4009
Packit 6c4009
  /* Scopes to free after next THREAD_GSCOPE_WAIT ().  */
Packit 6c4009
  EXTERN struct dl_scope_free_list
Packit 6c4009
  {
Packit 6c4009
    size_t count;
Packit 6c4009
    void *list[50];
Packit 6c4009
  } *_dl_scope_free_list;
Packit 6c4009
#if !THREAD_GSCOPE_IN_TCB
Packit 6c4009
  EXTERN int _dl_thread_gscope_count;
Packit 6c4009
#endif
Packit 6c4009
#ifdef SHARED
Packit 6c4009
};
Packit 6c4009
# define __rtld_global_attribute__
Packit 6c4009
# if IS_IN (rtld)
Packit 6c4009
#  ifdef HAVE_SDATA_SECTION
Packit 6c4009
#   define __rtld_local_attribute__ \
Packit 6c4009
	    __attribute__ ((visibility ("hidden"), section (".sdata")))
Packit 6c4009
#   undef __rtld_global_attribute__
Packit 6c4009
#   define __rtld_global_attribute__ __attribute__ ((section (".sdata")))
Packit 6c4009
#  else
Packit 6c4009
#   define __rtld_local_attribute__ __attribute__ ((visibility ("hidden")))
Packit 6c4009
#  endif
Packit 6c4009
extern struct rtld_global _rtld_local __rtld_local_attribute__;
Packit 6c4009
#  undef __rtld_local_attribute__
Packit 6c4009
# endif
Packit 6c4009
extern struct rtld_global _rtld_global __rtld_global_attribute__;
Packit 6c4009
# undef __rtld_global_attribute__
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#ifndef SHARED
Packit 6c4009
# define GLRO(name) _##name
Packit 6c4009
#else
Packit 6c4009
# if IS_IN (rtld)
Packit 6c4009
#  define GLRO(name) _rtld_local_ro._##name
Packit 6c4009
# else
Packit 6c4009
#  define GLRO(name) _rtld_global_ro._##name
Packit 6c4009
# endif
Packit 6c4009
struct rtld_global_ro
Packit 6c4009
{
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
  /* If nonzero the appropriate debug information is printed.  */
Packit 6c4009
  EXTERN int _dl_debug_mask;
Packit 6c4009
#define DL_DEBUG_LIBS	    (1 << 0)
Packit 6c4009
#define DL_DEBUG_IMPCALLS   (1 << 1)
Packit 6c4009
#define DL_DEBUG_BINDINGS   (1 << 2)
Packit 6c4009
#define DL_DEBUG_SYMBOLS    (1 << 3)
Packit 6c4009
#define DL_DEBUG_VERSIONS   (1 << 4)
Packit 6c4009
#define DL_DEBUG_RELOC      (1 << 5)
Packit 6c4009
#define DL_DEBUG_FILES      (1 << 6)
Packit 6c4009
#define DL_DEBUG_STATISTICS (1 << 7)
Packit 6c4009
#define DL_DEBUG_UNUSED	    (1 << 8)
Packit 6c4009
#define DL_DEBUG_SCOPES	    (1 << 9)
Packit 6c4009
/* These two are used only internally.  */
Packit 6c4009
#define DL_DEBUG_HELP       (1 << 10)
Packit 6c4009
#define DL_DEBUG_PRELINK    (1 << 11)
Packit 6c4009
Packit 6c4009
  /* OS version.  */
Packit 6c4009
  EXTERN unsigned int _dl_osversion;
Packit 6c4009
  /* Platform name.  */
Packit 6c4009
  EXTERN const char *_dl_platform;
Packit 6c4009
  EXTERN size_t _dl_platformlen;
Packit 6c4009
Packit 6c4009
  /* Cached value of `getpagesize ()'.  */
Packit 6c4009
  EXTERN size_t _dl_pagesize;
Packit 6c4009
Packit 6c4009
  /* Do we read from ld.so.cache?  */
Packit 6c4009
  EXTERN int _dl_inhibit_cache;
Packit 6c4009
Packit 6c4009
  /* Copy of the content of `_dl_main_searchlist' at startup time.  */
Packit 6c4009
  EXTERN struct r_scope_elem _dl_initial_searchlist;
Packit 6c4009
Packit 6c4009
  /* CLK_TCK as reported by the kernel.  */
Packit 6c4009
  EXTERN int _dl_clktck;
Packit 6c4009
Packit 6c4009
  /* If nonzero print warnings messages.  */
Packit 6c4009
  EXTERN int _dl_verbose;
Packit 6c4009
Packit 6c4009
  /* File descriptor to write debug messages to.  */
Packit 6c4009
  EXTERN int _dl_debug_fd;
Packit 6c4009
Packit 6c4009
  /* Do we do lazy relocations?  */
Packit 6c4009
  EXTERN int _dl_lazy;
Packit 6c4009
Packit 6c4009
  /* Nonzero if runtime lookups should not update the .got/.plt.  */
Packit 6c4009
  EXTERN int _dl_bind_not;
Packit 6c4009
Packit 6c4009
  /* Nonzero if references should be treated as weak during runtime
Packit 6c4009
     linking.  */
Packit 6c4009
  EXTERN int _dl_dynamic_weak;
Packit 6c4009
Packit 6c4009
  /* Default floating-point control word.  */
Packit 6c4009
  EXTERN fpu_control_t _dl_fpu_control;
Packit 6c4009
Packit 6c4009
  /* Expected cache ID.  */
Packit 6c4009
  EXTERN int _dl_correct_cache_id;
Packit 6c4009
Packit 6c4009
  /* Mask for hardware capabilities that are available.  */
Packit 6c4009
  EXTERN uint64_t _dl_hwcap;
Packit 6c4009
Packit 6c4009
#if !HAVE_TUNABLES
Packit 6c4009
  /* Mask for important hardware capabilities we honour. */
Packit 6c4009
  EXTERN uint64_t _dl_hwcap_mask;
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#ifdef HAVE_AUX_VECTOR
Packit 6c4009
  /* Pointer to the auxv list supplied to the program at startup.  */
Packit 6c4009
  EXTERN ElfW(auxv_t) *_dl_auxv;
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
  /* Get architecture specific definitions.  */
Packit 6c4009
#include <dl-procinfo.c>
Packit 6c4009
Packit 6c4009
  /* Names of shared object for which the RPATH should be ignored.  */
Packit 6c4009
  EXTERN const char *_dl_inhibit_rpath;
Packit 6c4009
Packit 6c4009
  /* Location of the binary.  */
Packit 6c4009
  EXTERN const char *_dl_origin_path;
Packit 6c4009
Packit 6c4009
  /* -1 if the dynamic linker should honor library load bias,
Packit 6c4009
     0 if not, -2 use the default (honor biases for normal
Packit 6c4009
     binaries, don't honor for PIEs).  */
Packit 6c4009
  EXTERN ElfW(Addr) _dl_use_load_bias;
Packit 6c4009
Packit Service 428455
  /* Size of surplus space in the static TLS area for dynamically
Packit Service 428455
     loaded modules with IE-model TLS or for TLSDESC optimization.
Packit Service 428455
     See comments in elf/dl-tls.c where it is initialized.  */
Packit Service 428455
  EXTERN size_t _dl_tls_static_surplus;
Packit Service 428455
Packit 6c4009
  /* Name of the shared object to be profiled (if any).  */
Packit 6c4009
  EXTERN const char *_dl_profile;
Packit 6c4009
  /* Filename of the output file.  */
Packit 6c4009
  EXTERN const char *_dl_profile_output;
Packit 6c4009
  /* Name of the object we want to trace the prelinking.  */
Packit 6c4009
  EXTERN const char *_dl_trace_prelink;
Packit 6c4009
  /* Map of shared object to be prelink traced.  */
Packit 6c4009
  EXTERN struct link_map *_dl_trace_prelink_map;
Packit 6c4009
Packit 6c4009
  /* All search directories defined at startup.  This is assigned a
Packit 6c4009
     non-NULL pointer by the ld.so startup code (after initialization
Packit 6c4009
     to NULL), so this can also serve as an indicator whether a copy
Packit 6c4009
     of ld.so is initialized and active.  See the rtld_active function
Packit 6c4009
     below.  */
Packit 6c4009
  EXTERN struct r_search_path_elem *_dl_init_all_dirs;
Packit 6c4009
Packit 6c4009
#ifdef NEED_DL_SYSINFO
Packit 6c4009
  /* Syscall handling improvements.  This is very specific to x86.  */
Packit 6c4009
  EXTERN uintptr_t _dl_sysinfo;
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#ifdef NEED_DL_SYSINFO_DSO
Packit 6c4009
  /* The vsyscall page is a virtual DSO pre-mapped by the kernel.
Packit 6c4009
     This points to its ELF header.  */
Packit 6c4009
  EXTERN const ElfW(Ehdr) *_dl_sysinfo_dso;
Packit 6c4009
Packit 6c4009
  /* At startup time we set up the normal DSO data structure for it,
Packit 6c4009
     and this points to it.  */
Packit 6c4009
  EXTERN struct link_map *_dl_sysinfo_map;
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
  /* Mask for more hardware capabilities that are available on some
Packit 6c4009
     platforms.  */
Packit 6c4009
  EXTERN uint64_t _dl_hwcap2;
Packit 6c4009
Packit 6c4009
#ifdef SHARED
Packit 6c4009
  /* We add a function table to _rtld_global which is then used to
Packit 6c4009
     call the function instead of going through the PLT.  The result
Packit 6c4009
     is that we can avoid exporting the functions and we do not jump
Packit 6c4009
     PLT relocations in libc.so.  */
Packit 6c4009
  void (*_dl_debug_printf) (const char *, ...)
Packit 6c4009
       __attribute__ ((__format__ (__printf__, 1, 2)));
Packit 6c4009
  void (*_dl_mcount) (ElfW(Addr) frompc, ElfW(Addr) selfpc);
Packit 6c4009
  lookup_t (*_dl_lookup_symbol_x) (const char *, struct link_map *,
Packit 6c4009
				   const ElfW(Sym) **, struct r_scope_elem *[],
Packit 6c4009
				   const struct r_found_version *, int, int,
Packit 6c4009
				   struct link_map *);
Packit 6c4009
  void *(*_dl_open) (const char *file, int mode, const void *caller_dlopen,
Packit 6c4009
		     Lmid_t nsid, int argc, char *argv[], char *env[]);
Packit 6c4009
  void (*_dl_close) (void *map);
Packit 6c4009
  void *(*_dl_tls_get_addr_soft) (struct link_map *);
Packit 6c4009
#ifdef HAVE_DL_DISCOVER_OSVERSION
Packit 6c4009
  int (*_dl_discover_osversion) (void);
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
  /* List of auditing interfaces.  */
Packit 6c4009
  struct audit_ifaces *_dl_audit;
Packit 6c4009
  unsigned int _dl_naudit;
Packit 6c4009
};
Packit 6c4009
# define __rtld_global_attribute__
Packit 6c4009
# if IS_IN (rtld)
Packit 6c4009
#  define __rtld_local_attribute__ __attribute__ ((visibility ("hidden")))
Packit 6c4009
extern struct rtld_global_ro _rtld_local_ro
Packit 6c4009
    attribute_relro __rtld_local_attribute__;
Packit 6c4009
extern struct rtld_global_ro _rtld_global_ro
Packit 6c4009
    attribute_relro __rtld_global_attribute__;
Packit 6c4009
#  undef __rtld_local_attribute__
Packit 6c4009
# else
Packit 6c4009
/* We cheat a bit here.  We declare the variable as as const even
Packit 6c4009
   though it is at startup.  */
Packit 6c4009
extern const struct rtld_global_ro _rtld_global_ro
Packit 6c4009
    attribute_relro __rtld_global_attribute__;
Packit 6c4009
# endif
Packit 6c4009
# undef __rtld_global_attribute__
Packit 6c4009
#endif
Packit 6c4009
#undef EXTERN
Packit 6c4009
Packit 6c4009
#ifndef SHARED
Packit 6c4009
/* dl-support.c defines these and initializes them early on.  */
Packit 6c4009
extern const ElfW(Phdr) *_dl_phdr;
Packit 6c4009
extern size_t _dl_phnum;
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* This is the initial value of GL(dl_make_stack_executable_hook).
Packit 6c4009
   A threads library can change it.  */
Packit 6c4009
extern int _dl_make_stack_executable (void **stack_endp);
Packit 6c4009
rtld_hidden_proto (_dl_make_stack_executable)
Packit 6c4009
Packit 6c4009
/* Variable pointing to the end of the stack (or close to it).  This value
Packit 6c4009
   must be constant over the runtime of the application.  Some programs
Packit 6c4009
   might use the variable which results in copy relocations on some
Packit 6c4009
   platforms.  But this does not matter, ld.so can always use the local
Packit 6c4009
   copy.  */
Packit 6c4009
extern void *__libc_stack_end
Packit 6c4009
#ifndef LIBC_STACK_END_NOT_RELRO
Packit 6c4009
     attribute_relro
Packit 6c4009
#endif
Packit 6c4009
     ;
Packit 6c4009
rtld_hidden_proto (__libc_stack_end)
Packit 6c4009
Packit 6c4009
/* Parameters passed to the dynamic linker.  */
Packit 6c4009
extern int _dl_argc attribute_hidden attribute_relro;
Packit 6c4009
extern char **_dl_argv
Packit 6c4009
#ifndef DL_ARGV_NOT_RELRO
Packit 6c4009
     attribute_relro
Packit 6c4009
#endif
Packit 6c4009
     ;
Packit 6c4009
rtld_hidden_proto (_dl_argv)
Packit 6c4009
#if IS_IN (rtld)
Packit 6c4009
extern unsigned int _dl_skip_args attribute_hidden
Packit 6c4009
# ifndef DL_ARGV_NOT_RELRO
Packit 6c4009
     attribute_relro
Packit 6c4009
# endif
Packit 6c4009
     ;
Packit 6c4009
extern unsigned int _dl_skip_args_internal attribute_hidden
Packit 6c4009
# ifndef DL_ARGV_NOT_RELRO
Packit 6c4009
     attribute_relro
Packit 6c4009
# endif
Packit 6c4009
     ;
Packit 6c4009
#endif
Packit 6c4009
#define rtld_progname _dl_argv[0]
Packit 6c4009
Packit 6c4009
/* Flag set at startup and cleared when the last initializer has run.  */
Packit 6c4009
extern int _dl_starting_up;
Packit 6c4009
weak_extern (_dl_starting_up)
Packit 6c4009
rtld_hidden_proto (_dl_starting_up)
Packit 6c4009
Packit 6c4009
/* Random data provided by the kernel.  */
Packit 6c4009
extern void *_dl_random attribute_hidden attribute_relro;
Packit 6c4009
Packit 6c4009
/* OS-dependent function to open the zero-fill device.  */
Packit 6c4009
extern int _dl_sysdep_open_zero_fill (void); /* dl-sysdep.c */
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Write message on the debug file descriptor.  The parameters are
Packit 6c4009
   interpreted as for a `printf' call.  All the lines start with a
Packit 6c4009
   tag showing the PID.  */
Packit 6c4009
extern void _dl_debug_printf (const char *fmt, ...)
Packit 6c4009
     __attribute__ ((__format__ (__printf__, 1, 2))) attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Write message on the debug file descriptor.  The parameters are
Packit 6c4009
   interpreted as for a `printf' call.  All the lines buf the first
Packit 6c4009
   start with a tag showing the PID.  */
Packit 6c4009
extern void _dl_debug_printf_c (const char *fmt, ...)
Packit 6c4009
     __attribute__ ((__format__ (__printf__, 1, 2))) attribute_hidden;
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Write a message on the specified descriptor FD.  The parameters are
Packit 6c4009
   interpreted as for a `printf' call.  */
Packit 6c4009
#if IS_IN (rtld) || !defined (SHARED)
Packit 6c4009
extern void _dl_dprintf (int fd, const char *fmt, ...)
Packit 6c4009
     __attribute__ ((__format__ (__printf__, 2, 3)))
Packit 6c4009
     attribute_hidden;
Packit 6c4009
#else
Packit 6c4009
__attribute__ ((always_inline, __format__ (__printf__, 2, 3)))
Packit 6c4009
static inline void
Packit 6c4009
_dl_dprintf (int fd, const char *fmt, ...)
Packit 6c4009
{
Packit 6c4009
  /* Use local declaration to avoid includign <stdio.h>.  */
Packit 6c4009
  extern int __dprintf(int fd, const char *format, ...) attribute_hidden;
Packit 6c4009
  __dprintf (fd, fmt, __builtin_va_arg_pack ());
Packit 6c4009
}
Packit 6c4009
#endif
Packit 6c4009
Packit Service bb3d75
/* Write LENGTH bytes at BUFFER to FD, like write.  Returns the number
Packit Service bb3d75
   of bytes written on success, or a negative error constant on
Packit Service bb3d75
   failure.  */
Packit Service bb3d75
ssize_t _dl_write (int fd, const void *buffer, size_t length)
Packit Service bb3d75
  attribute_hidden;
Packit Service bb3d75
Packit 6c4009
/* Write a message on the specified descriptor standard output.  The
Packit 6c4009
   parameters are interpreted as for a `printf' call.  */
Packit 6c4009
#define _dl_printf(fmt, args...) \
Packit 6c4009
  _dl_dprintf (STDOUT_FILENO, fmt, ##args)
Packit 6c4009
Packit 6c4009
/* Write a message on the specified descriptor standard error.  The
Packit 6c4009
   parameters are interpreted as for a `printf' call.  */
Packit 6c4009
#define _dl_error_printf(fmt, args...) \
Packit 6c4009
  _dl_dprintf (STDERR_FILENO, fmt, ##args)
Packit 6c4009
Packit 6c4009
/* Write a message on the specified descriptor standard error and exit
Packit 6c4009
   the program.  The parameters are interpreted as for a `printf' call.  */
Packit 6c4009
#define _dl_fatal_printf(fmt, args...) \
Packit 6c4009
  do									      \
Packit 6c4009
    {									      \
Packit 6c4009
      _dl_dprintf (STDERR_FILENO, fmt, ##args);				      \
Packit 6c4009
      _exit (127);							      \
Packit 6c4009
    }									      \
Packit 6c4009
  while (1)
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* An exception raised by the _dl_signal_error function family and
Packit 6c4009
   caught by _dl_catch_error function family.  Exceptions themselves
Packit 6c4009
   are copied as part of the raise operation, but the strings are
Packit 6c4009
   not.  */
Packit 6c4009
struct dl_exception
Packit 6c4009
{
Packit 6c4009
  const char *objname;
Packit 6c4009
  const char *errstring;
Packit 6c4009
Packit 6c4009
  /* This buffer typically stores both objname and errstring
Packit 6c4009
     above.  */
Packit 6c4009
  char *message_buffer;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
/* Creates a new exception.  This calls malloc; if allocation fails,
Packit 6c4009
   dummy values are inserted.  OBJECT is the name of the problematical
Packit 6c4009
   shared object, or null if its a general problem.  ERRSTRING is a
Packit 6c4009
   string describing the specific problem.  */
Packit 6c4009
void _dl_exception_create (struct dl_exception *, const char *object,
Packit 6c4009
			   const char *errstring)
Packit 6c4009
  __attribute__ ((nonnull (1, 3)));
Packit 6c4009
rtld_hidden_proto (_dl_exception_create)
Packit 6c4009
Packit 6c4009
/* Like _dl_exception_create, but create errstring from a format
Packit 6c4009
   string FMT.  Currently, only "%s" and "%%" are supported as format
Packit 6c4009
   directives.  */
Packit 6c4009
void _dl_exception_create_format (struct dl_exception *, const char *objname,
Packit 6c4009
				  const char *fmt, ...)
Packit 6c4009
  __attribute__ ((nonnull (1, 3), format (printf, 3, 4)));
Packit 6c4009
rtld_hidden_proto (_dl_exception_create_format)
Packit 6c4009
Packit 6c4009
/* Deallocate the exception, freeing allocated buffers (if
Packit 6c4009
   possible).  */
Packit 6c4009
void _dl_exception_free (struct dl_exception *)
Packit 6c4009
  __attribute__ ((nonnull (1)));
Packit 6c4009
rtld_hidden_proto (_dl_exception_free)
Packit 6c4009
Packit 6c4009
/* This function is called by all the internal dynamic linker
Packit 6c4009
   functions when they encounter an error.  ERRCODE is either an
Packit 6c4009
   `errno' code or zero; it specifies the return value of
Packit 6c4009
   _dl_catch_error.  OCCASION is included in the error message if the
Packit 6c4009
   process is terminated immediately.  */
Packit 6c4009
void _dl_signal_exception (int errcode, struct dl_exception *,
Packit 6c4009
			   const char *occasion)
Packit 6c4009
  __attribute__ ((__noreturn__));
Packit 6c4009
libc_hidden_proto (_dl_signal_exception)
Packit 6c4009
Packit 6c4009
/* Like _dl_signal_exception, but creates the exception first.  */
Packit 6c4009
extern void _dl_signal_error (int errcode, const char *object,
Packit 6c4009
			      const char *occasion, const char *errstring)
Packit 6c4009
     __attribute__ ((__noreturn__));
Packit 6c4009
libc_hidden_proto (_dl_signal_error)
Packit 6c4009
Packit 6c4009
/* Like _dl_signal_exception, but may return when called in the
Packit 6c4009
   context of _dl_receive_error.  This is only used during ld.so
Packit 6c4009
   bootstrap.  In static and profiled builds, this is equivalent to
Packit 6c4009
   _dl_signal_exception.  */
Packit 6c4009
#if IS_IN (rtld)
Packit 6c4009
extern void _dl_signal_cexception (int errcode, struct dl_exception *,
Packit 6c4009
				   const char *occasion) attribute_hidden;
Packit 6c4009
#else
Packit 6c4009
__attribute__ ((always_inline))
Packit 6c4009
static inline void
Packit 6c4009
_dl_signal_cexception (int errcode, struct dl_exception *exception,
Packit 6c4009
		       const char *occasion)
Packit 6c4009
{
Packit 6c4009
  _dl_signal_exception (errcode, exception, occasion);
Packit 6c4009
}
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* See _dl_signal_cexception above.  */
Packit 6c4009
#if IS_IN (rtld)
Packit 6c4009
extern void _dl_signal_cerror (int errcode, const char *object,
Packit 6c4009
			       const char *occasion, const char *errstring)
Packit 6c4009
     attribute_hidden;
Packit 6c4009
#else
Packit 6c4009
__attribute__ ((always_inline))
Packit 6c4009
static inline void
Packit 6c4009
_dl_signal_cerror (int errcode, const char *object,
Packit 6c4009
			       const char *occasion, const char *errstring)
Packit 6c4009
{
Packit 6c4009
  _dl_signal_error (errcode, object, occasion, errstring);
Packit 6c4009
}
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Call OPERATE, receiving errors from `dl_signal_cerror'.  Unlike
Packit 6c4009
   `_dl_catch_error' the operation is resumed after the OPERATE
Packit 6c4009
   function returns.
Packit 6c4009
   ARGS is passed as argument to OPERATE.  */
Packit 6c4009
extern void _dl_receive_error (receiver_fct fct, void (*operate) (void *),
Packit 6c4009
			       void *args) attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Call OPERATE, catching errors from `_dl_signal_error' and related
Packit 6c4009
   functions.  If there is no error, *ERRSTRING is set to null.  If
Packit 6c4009
   there is an error, *ERRSTRING is set to a string constructed from
Packit 6c4009
   the strings passed to _dl_signal_error, and the error code passed
Packit 6c4009
   is the return value and *OBJNAME is set to the object name which
Packit 6c4009
   experienced the problems.  ERRSTRING if nonzero points to a
Packit 6c4009
   malloc'ed string which the caller has to free after use.  ARGS is
Packit 6c4009
   passed as argument to OPERATE.  MALLOCEDP is set to true only if
Packit 6c4009
   the returned string is allocated using the libc's malloc.  */
Packit 6c4009
extern int _dl_catch_error (const char **objname, const char **errstring,
Packit 6c4009
			    bool *mallocedp, void (*operate) (void *),
Packit 6c4009
			    void *args);
Packit 6c4009
libc_hidden_proto (_dl_catch_error)
Packit 6c4009
Packit 6c4009
/* Call OPERATE (ARGS).  If no error occurs, set *EXCEPTION to zero.
Packit 6c4009
   Otherwise, store a copy of the raised exception in *EXCEPTION,
Packit Service 439716
   which has to be freed by _dl_exception_free.  As a special case, if
Packit Service 439716
   EXCEPTION is null, call OPERATE (ARGS) with exception handling
Packit Service 439716
   disabled (so that exceptions are fatal).  */
Packit 6c4009
int _dl_catch_exception (struct dl_exception *exception,
Packit 6c4009
			 void (*operate) (void *), void *args);
Packit 6c4009
libc_hidden_proto (_dl_catch_exception)
Packit 6c4009
Packit 6c4009
/* Open the shared object NAME and map in its segments.
Packit 6c4009
   LOADER's DT_RPATH is used in searching for NAME.
Packit 6c4009
   If the object is already opened, returns its existing map.  */
Packit 6c4009
extern struct link_map *_dl_map_object (struct link_map *loader,
Packit 6c4009
					const char *name,
Packit 6c4009
					int type, int trace_mode, int mode,
Packit 6c4009
					Lmid_t nsid) attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Call _dl_map_object on the dependencies of MAP, and set up
Packit 6c4009
   MAP->l_searchlist.  PRELOADS points to a vector of NPRELOADS previously
Packit 6c4009
   loaded objects that will be inserted into MAP->l_searchlist after MAP
Packit 6c4009
   but before its dependencies.  */
Packit 6c4009
extern void _dl_map_object_deps (struct link_map *map,
Packit 6c4009
				 struct link_map **preloads,
Packit 6c4009
				 unsigned int npreloads, int trace_mode,
Packit 6c4009
				 int open_mode)
Packit 6c4009
     attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Cache the locations of MAP's hash table.  */
Packit 6c4009
extern void _dl_setup_hash (struct link_map *map) attribute_hidden;
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Collect the directories in the search path for LOADER's dependencies.
Packit 6c4009
   The data structure is defined in <dlfcn.h>.  If COUNTING is true,
Packit 6c4009
   SI->dls_cnt and SI->dls_size are set; if false, those must be as set
Packit 6c4009
   by a previous call with COUNTING set, and SI must point to SI->dls_size
Packit 6c4009
   bytes to be used in filling in the result.  */
Packit 6c4009
extern void _dl_rtld_di_serinfo (struct link_map *loader,
Packit 6c4009
				 Dl_serinfo *si, bool counting);
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Search loaded objects' symbol tables for a definition of the symbol
Packit 6c4009
   referred to by UNDEF.  *SYM is the symbol table entry containing the
Packit 6c4009
   reference; it is replaced with the defining symbol, and the base load
Packit 6c4009
   address of the defining object is returned.  SYMBOL_SCOPE is a
Packit 6c4009
   null-terminated list of object scopes to search; each object's
Packit 6c4009
   l_searchlist (i.e. the segment of the dependency tree starting at that
Packit 6c4009
   object) is searched in turn.  REFERENCE_NAME should name the object
Packit 6c4009
   containing the reference; it is used in error messages.
Packit 6c4009
   TYPE_CLASS describes the type of symbol we are looking for.  */
Packit 6c4009
enum
Packit 6c4009
  {
Packit 6c4009
    /* If necessary add dependency between user and provider object.  */
Packit 6c4009
    DL_LOOKUP_ADD_DEPENDENCY = 1,
Packit 6c4009
    /* Return most recent version instead of default version for
Packit 6c4009
       unversioned lookup.  */
Packit 6c4009
    DL_LOOKUP_RETURN_NEWEST = 2,
Packit 6c4009
    /* Set if dl_lookup* called with GSCOPE lock held.  */
Packit 6c4009
    DL_LOOKUP_GSCOPE_LOCK = 4,
Packit Service d5f3e8
    /* Set if dl_lookup is called for non-lazy relocation processing
Packit Service d5f3e8
       from _dl_relocate_object in elf/dl-reloc.c.  */
Packit Service d5f3e8
    DL_LOOKUP_FOR_RELOCATE = 8,
Packit 6c4009
  };
Packit 6c4009
Packit 6c4009
/* Lookup versioned symbol.  */
Packit 6c4009
extern lookup_t _dl_lookup_symbol_x (const char *undef,
Packit 6c4009
				     struct link_map *undef_map,
Packit 6c4009
				     const ElfW(Sym) **sym,
Packit 6c4009
				     struct r_scope_elem *symbol_scope[],
Packit 6c4009
				     const struct r_found_version *version,
Packit 6c4009
				     int type_class, int flags,
Packit 6c4009
				     struct link_map *skip_map)
Packit 6c4009
     attribute_hidden;
Packit 6c4009
Packit 6c4009
Packit Service 11a55a
/* Restricted version of _dl_lookup_symbol_x.  Searches MAP (and only
Packit Service 11a55a
   MAP) for the symbol UNDEF_NAME, with GNU hash NEW_HASH (computed
Packit Service 11a55a
   with dl_new_hash), symbol version VERSION, and symbol version hash
Packit Service 11a55a
   VERSION_HASH (computed with _dl_elf_hash).  Returns a pointer to
Packit Service 11a55a
   the symbol table entry in MAP on success, or NULL on failure.  MAP
Packit Service 11a55a
   must have symbol versioning information, or otherwise the result is
Packit Service 11a55a
   undefined.  */
Packit Service 11a55a
const ElfW(Sym) *_dl_lookup_direct (struct link_map *map,
Packit Service 11a55a
				    const char *undef_name,
Packit Service 11a55a
				    uint32_t new_hash,
Packit Service 11a55a
				    const char *version,
Packit Service 11a55a
				    uint32_t version_hash) attribute_hidden;
Packit Service 11a55a
Packit 6c4009
/* Add the new link_map NEW to the end of the namespace list.  */
Packit 6c4009
extern void _dl_add_to_namespace_list (struct link_map *new, Lmid_t nsid)
Packit 6c4009
     attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Allocate a `struct link_map' for a new object being loaded.  */
Packit 6c4009
extern struct link_map *_dl_new_object (char *realname, const char *libname,
Packit 6c4009
					int type, struct link_map *loader,
Packit 6c4009
					int mode, Lmid_t nsid)
Packit 6c4009
     attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Relocate the given object (if it hasn't already been).
Packit 6c4009
   SCOPE is passed to _dl_lookup_symbol in symbol lookups.
Packit 6c4009
   If RTLD_LAZY is set in RELOC-MODE, don't relocate its PLT.  */
Packit 6c4009
extern void _dl_relocate_object (struct link_map *map,
Packit 6c4009
				 struct r_scope_elem *scope[],
Packit 6c4009
				 int reloc_mode, int consider_profiling)
Packit 6c4009
     attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Protect PT_GNU_RELRO area.  */
Packit 6c4009
extern void _dl_protect_relro (struct link_map *map) attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Call _dl_signal_error with a message about an unhandled reloc type.
Packit 6c4009
   TYPE is the result of ELFW(R_TYPE) (r_info), i.e. an R_<CPU>_* value.
Packit 6c4009
   PLT is nonzero if this was a PLT reloc; it just affects the message.  */
Packit 6c4009
extern void _dl_reloc_bad_type (struct link_map *map,
Packit 6c4009
				unsigned int type, int plt)
Packit 6c4009
     attribute_hidden __attribute__ ((__noreturn__));
Packit 6c4009
Packit 6c4009
/* Resolve conflicts if prelinking.  */
Packit 6c4009
extern void _dl_resolve_conflicts (struct link_map *l,
Packit 6c4009
				   ElfW(Rela) *conflict,
Packit 6c4009
				   ElfW(Rela) *conflictend)
Packit 6c4009
     attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Check the version dependencies of all objects available through
Packit 6c4009
   MAP.  If VERBOSE print some more diagnostics.  */
Packit 6c4009
extern int _dl_check_all_versions (struct link_map *map, int verbose,
Packit 6c4009
				   int trace_mode) attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Check the version dependencies for MAP.  If VERBOSE print some more
Packit 6c4009
   diagnostics.  */
Packit 6c4009
extern int _dl_check_map_versions (struct link_map *map, int verbose,
Packit 6c4009
				   int trace_mode) attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Initialize the object in SCOPE by calling the constructors with
Packit 6c4009
   ARGC, ARGV, and ENV as the parameters.  */
Packit 6c4009
extern void _dl_init (struct link_map *main_map, int argc, char **argv,
Packit 6c4009
		      char **env) attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Call the finalizer functions of all shared objects whose
Packit 6c4009
   initializer functions have completed.  */
Packit 6c4009
extern void _dl_fini (void) attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Sort array MAPS according to dependencies of the contained objects.  */
Packit 6c4009
extern void _dl_sort_maps (struct link_map **maps, unsigned int nmaps,
Packit 6c4009
			   char *used, bool for_fini) attribute_hidden;
Packit 6c4009
Packit 6c4009
/* The dynamic linker calls this function before and having changing
Packit 6c4009
   any shared object mappings.  The `r_state' member of `struct r_debug'
Packit 6c4009
   says what change is taking place.  This function's address is
Packit 6c4009
   the value of the `r_brk' member.  */
Packit 6c4009
extern void _dl_debug_state (void);
Packit 6c4009
rtld_hidden_proto (_dl_debug_state)
Packit 6c4009
Packit 6c4009
/* Initialize `struct r_debug' if it has not already been done.  The
Packit 6c4009
   argument is the run-time load address of the dynamic linker, to be put
Packit 6c4009
   in the `r_ldbase' member.  Returns the address of the structure.  */
Packit 6c4009
extern struct r_debug *_dl_debug_initialize (ElfW(Addr) ldbase, Lmid_t ns)
Packit 6c4009
     attribute_hidden;
Packit 6c4009
Packit Service 27258b
/* Initialize the basic data structure for the search paths.  SOURCE
Packit Service 27258b
   is either "LD_LIBRARY_PATH" or "--library-path".  */
Packit Service 27258b
extern void _dl_init_paths (const char *library_path, const char *source)
Packit Service 27258b
  attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Gather the information needed to install the profiling tables and start
Packit 6c4009
   the timers.  */
Packit 6c4009
extern void _dl_start_profile (void) attribute_hidden;
Packit 6c4009
Packit 6c4009
/* The actual functions used to keep book on the calls.  */
Packit 6c4009
extern void _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc);
Packit 6c4009
rtld_hidden_proto (_dl_mcount)
Packit 6c4009
Packit 6c4009
/* This function is simply a wrapper around the _dl_mcount function
Packit 6c4009
   which does not require a FROMPC parameter since this is the
Packit 6c4009
   calling function.  */
Packit 6c4009
extern void _dl_mcount_wrapper (void *selfpc);
Packit 6c4009
Packit 6c4009
/* Show the members of the auxiliary array passed up from the kernel.  */
Packit 6c4009
extern void _dl_show_auxv (void) attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Return all environment variables starting with `LD_', one after the
Packit 6c4009
   other.  */
Packit 6c4009
extern char *_dl_next_ld_env_entry (char ***position) attribute_hidden;
Packit 6c4009
Packit Service 68b29c
/* Return an array with the names of the important hardware
Packit Service 68b29c
   capabilities.  The length of the array is written to *SZ, and the
Packit Service 68b29c
   maximum of all strings length is written to *MAX_CAPSTRLEN.  */
Packit Service 68b29c
const struct r_strlenpair *_dl_important_hwcaps (size_t *sz,
Packit Service 68b29c
						 size_t *max_capstrlen)
Packit Service 68b29c
  attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Look up NAME in ld.so.cache and return the file name stored there,
Packit 6c4009
   or null if none is found.  Caller must free returned string.  */
Packit 6c4009
extern char *_dl_load_cache_lookup (const char *name) attribute_hidden;
Packit 6c4009
Packit 6c4009
/* If the system does not support MAP_COPY we cannot leave the file open
Packit 6c4009
   all the time since this would create problems when the file is replaced.
Packit 6c4009
   Therefore we provide this function to close the file and open it again
Packit 6c4009
   once needed.  */
Packit 6c4009
extern void _dl_unload_cache (void) attribute_hidden;
Packit 6c4009
Packit 6c4009
/* System-dependent function to read a file's whole contents in the
Packit 6c4009
   most convenient manner available.  *SIZEP gets the size of the
Packit 6c4009
   file.  On error MAP_FAILED is returned.  */
Packit 6c4009
extern void *_dl_sysdep_read_whole_file (const char *file, size_t *sizep,
Packit 6c4009
					 int prot) attribute_hidden;
Packit 6c4009
Packit 6c4009
/* System-specific function to do initial startup for the dynamic linker.
Packit 6c4009
   After this, file access calls and getenv must work.  This is responsible
Packit 6c4009
   for setting __libc_enable_secure if we need to be secure (e.g. setuid),
Packit 6c4009
   and for setting _dl_argc and _dl_argv, and then calling _dl_main.  */
Packit 6c4009
extern ElfW(Addr) _dl_sysdep_start (void **start_argptr,
Packit 6c4009
				    void (*dl_main) (const ElfW(Phdr) *phdr,
Packit 6c4009
						     ElfW(Word) phnum,
Packit 6c4009
						     ElfW(Addr) *user_entry,
Packit 6c4009
						     ElfW(auxv_t) *auxv))
Packit 6c4009
     attribute_hidden;
Packit 6c4009
Packit 6c4009
extern void _dl_sysdep_start_cleanup (void) attribute_hidden;
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Determine next available module ID.  */
Packit 6c4009
extern size_t _dl_next_tls_modid (void) attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Count the modules with TLS segments.  */
Packit 6c4009
extern size_t _dl_count_modids (void) attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Calculate offset of the TLS blocks in the static TLS block.  */
Packit 6c4009
extern void _dl_determine_tlsoffset (void) attribute_hidden;
Packit 6c4009
Packit Service 13d859
/* Calculate the size of the static TLS surplus, when the given
Packit Service 13d859
   number of audit modules are loaded.  */
Packit Service 13d859
void _dl_tls_static_surplus_init (size_t naudit) attribute_hidden;
Packit Service 428455
Packit 6c4009
#ifndef SHARED
Packit 6c4009
/* Set up the TCB for statically linked applications.  This is called
Packit 6c4009
   early during startup because we always use TLS (for errno and the
Packit 6c4009
   stack protector, among other things).  */
Packit 6c4009
void __libc_setup_tls (void);
Packit 6c4009
Packit 6c4009
# if ENABLE_STATIC_PIE
Packit 6c4009
/* Relocate static executable with PIE.  */
Packit 6c4009
extern void _dl_relocate_static_pie (void) attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Get a pointer to _dl_main_map.  */
Packit 6c4009
extern struct link_map * _dl_get_dl_main_map (void)
Packit 6c4009
  __attribute__ ((visibility ("hidden")));
Packit 6c4009
# else
Packit 6c4009
#  define _dl_relocate_static_pie()
Packit 6c4009
# endif
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Initialization of libpthread for statically linked applications.
Packit 6c4009
   If libpthread is not linked in, this is an empty function.  */
Packit 6c4009
void __pthread_initialize_minimal (void) weak_function;
Packit 6c4009
Packit 6c4009
/* Allocate memory for static TLS block (unless MEM is nonzero) and dtv.  */
Packit 6c4009
extern void *_dl_allocate_tls (void *mem);
Packit 6c4009
rtld_hidden_proto (_dl_allocate_tls)
Packit 6c4009
Packit 6c4009
/* Get size and alignment requirements of the static TLS block.  */
Packit 6c4009
extern void _dl_get_tls_static_info (size_t *sizep, size_t *alignp);
Packit 6c4009
Packit 6c4009
extern void _dl_allocate_static_tls (struct link_map *map) attribute_hidden;
Packit 6c4009
Packit 6c4009
/* These are internal entry points to the two halves of _dl_allocate_tls,
Packit 6c4009
   only used within rtld.c itself at startup time.  */
Packit 6c4009
extern void *_dl_allocate_tls_storage (void) attribute_hidden;
Packit 6c4009
extern void *_dl_allocate_tls_init (void *);
Packit 6c4009
rtld_hidden_proto (_dl_allocate_tls_init)
Packit 6c4009
Packit 6c4009
/* Deallocate memory allocated with _dl_allocate_tls.  */
Packit 6c4009
extern void _dl_deallocate_tls (void *tcb, bool dealloc_tcb);
Packit 6c4009
rtld_hidden_proto (_dl_deallocate_tls)
Packit 6c4009
Packit 6c4009
extern void _dl_nothread_init_static_tls (struct link_map *) attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Find origin of the executable.  */
Packit 6c4009
extern const char *_dl_get_origin (void) attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Count DSTs.  */
Packit 6c4009
extern size_t _dl_dst_count (const char *name) attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Substitute DST values.  */
Packit 6c4009
extern char *_dl_dst_substitute (struct link_map *l, const char *name,
Packit 6c4009
				 char *result) attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Open the shared object NAME, relocate it, and run its initializer if it
Packit 6c4009
   hasn't already been run.  MODE is as for `dlopen' (see <dlfcn.h>).  If
Packit 6c4009
   the object is already opened, returns its existing map.  */
Packit 6c4009
extern void *_dl_open (const char *name, int mode, const void *caller,
Packit 6c4009
		       Lmid_t nsid, int argc, char *argv[], char *env[])
Packit 6c4009
     attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Free or queue for freeing scope OLD.  If other threads might be
Packit 6c4009
   in the middle of _dl_fixup, _dl_profile_fixup or dl*sym using the
Packit 6c4009
   old scope, OLD can't be freed until no thread is using it.  */
Packit 6c4009
extern int _dl_scope_free (void *) attribute_hidden;
Packit 6c4009
Packit Service 77abab
Packit Service 77abab
/* Add module to slot information data.  If DO_ADD is false, only the
Packit Service 77abab
   required memory is allocated.  Must be called with GL
Packit Service 77abab
   (dl_load_lock) acquired.  If the function has already been called
Packit Service 77abab
   for the link map L with !do_add, then this function will not raise
Packit Service 77abab
   an exception, otherwise it is possible that it encounters a memory
Packit Service 77abab
   allocation failure.  */
Packit Service 77abab
extern void _dl_add_to_slotinfo (struct link_map *l, bool do_add)
Packit Service 77abab
  attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Update slot information data for at least the generation of the
Packit 6c4009
   module with the given index.  */
Packit 6c4009
extern struct link_map *_dl_update_slotinfo (unsigned long int req_modid)
Packit 6c4009
     attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Look up the module's TLS block as for __tls_get_addr,
Packit 6c4009
   but never touch anything.  Return null if it's not allocated yet.  */
Packit 6c4009
extern void *_dl_tls_get_addr_soft (struct link_map *l) attribute_hidden;
Packit 6c4009
Packit 6c4009
extern int _dl_addr_inside_object (struct link_map *l, const ElfW(Addr) addr)
Packit 6c4009
     attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Show show of an object.  */
Packit 6c4009
extern void _dl_show_scope (struct link_map *new, int from)
Packit 6c4009
     attribute_hidden;
Packit 6c4009
Packit 6c4009
extern struct link_map *_dl_find_dso_for_object (const ElfW(Addr) addr);
Packit 6c4009
rtld_hidden_proto (_dl_find_dso_for_object)
Packit 6c4009
Packit 6c4009
/* Initialization which is normally done by the dynamic linker.  */
Packit 6c4009
extern void _dl_non_dynamic_init (void)
Packit 6c4009
     attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Used by static binaries to check the auxiliary vector.  */
Packit 6c4009
extern void _dl_aux_init (ElfW(auxv_t) *av)
Packit 6c4009
     attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Return true if the ld.so copy in this namespace is actually active
Packit 6c4009
   and working.  If false, the dl_open/dlfcn hooks have to be used to
Packit 6c4009
   call into the outer dynamic linker (which happens after static
Packit 6c4009
   dlopen).  */
Packit 6c4009
#ifdef SHARED
Packit 6c4009
static inline bool
Packit 6c4009
rtld_active (void)
Packit 6c4009
{
Packit 6c4009
  /* The default-initialized variable does not have a non-zero
Packit 6c4009
     dl_init_all_dirs member, so this allows us to recognize an
Packit 6c4009
     initialized and active ld.so copy.  */
Packit 6c4009
  return GLRO(dl_init_all_dirs) != NULL;
Packit 6c4009
}
Packit Service a2b226
Packit Service a2b226
static inline struct auditstate *
Packit Service a2b226
link_map_audit_state (struct link_map *l, size_t index)
Packit Service a2b226
{
Packit Service a2b226
  return &l->l_audit[index];
Packit Service a2b226
}
Packit Service a2b226
#endif /* SHARED */
Packit 6c4009
Packit 6c4009
__END_DECLS
Packit 6c4009
Packit 6c4009
#endif /* ldsodefs.h */