Blame sysdeps/generic/ldsodefs.h

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