Blame elf/dl-main.h

Packit Service 1182c4
/* Information collection during ld.so startup.
Packit Service 1182c4
   Copyright (C) 1995-2020 Free Software Foundation, Inc.
Packit Service 1182c4
   This file is part of the GNU C Library.
Packit Service 1182c4
Packit Service 1182c4
   The GNU C Library is free software; you can redistribute it and/or
Packit Service 1182c4
   modify it under the terms of the GNU Lesser General Public
Packit Service 1182c4
   License as published by the Free Software Foundation; either
Packit Service 1182c4
   version 2.1 of the License, or (at your option) any later version.
Packit Service 1182c4
Packit Service 1182c4
   The GNU C Library is distributed in the hope that it will be useful,
Packit Service 1182c4
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 1182c4
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 1182c4
   Lesser General Public License for more details.
Packit Service 1182c4
Packit Service 1182c4
   You should have received a copy of the GNU Lesser General Public
Packit Service 1182c4
   License along with the GNU C Library; if not, see
Packit Service 1182c4
   <https://www.gnu.org/licenses/>.  */
Packit Service 1182c4
Packit Service 1182c4
#ifndef _DL_MAIN
Packit Service 1182c4
#define _DL_MAIN
Packit Service 1182c4
Packit Service ad9b00
#include <ldsodefs.h>
Packit Service 1182c4
#include <limits.h>
Packit Service ad9b00
#include <stdlib.h>
Packit Service 1182c4
Packit Service 1182c4
/* Length limits for names and paths, to protect the dynamic linker,
Packit Service 1182c4
   particularly when __libc_enable_secure is active.  */
Packit Service 1182c4
#ifdef NAME_MAX
Packit Service 1182c4
# define SECURE_NAME_LIMIT NAME_MAX
Packit Service 1182c4
#else
Packit Service 1182c4
# define SECURE_NAME_LIMIT 255
Packit Service 1182c4
#endif
Packit Service 1182c4
#ifdef PATH_MAX
Packit Service 1182c4
# define SECURE_PATH_LIMIT PATH_MAX
Packit Service 1182c4
#else
Packit Service 1182c4
# define SECURE_PATH_LIMIT 1024
Packit Service 1182c4
#endif
Packit Service 1182c4
Packit Service 1182c4
/* Strings containing colon-separated lists of audit modules.  */
Packit Service 1182c4
struct audit_list
Packit Service 1182c4
{
Packit Service 1182c4
  /* Array of strings containing colon-separated path lists.  Each
Packit Service 1182c4
     audit module needs its own namespace, so pre-allocate the largest
Packit Service 1182c4
     possible list.  */
Packit Service 1182c4
  const char *audit_strings[DL_NNS];
Packit Service 1182c4
Packit Service 1182c4
  /* Number of entries added to audit_strings.  */
Packit Service 1182c4
  size_t length;
Packit Service 1182c4
Packit Service 1182c4
  /* Index into the audit_strings array (for the iteration phase).  */
Packit Service 1182c4
  size_t current_index;
Packit Service 1182c4
Packit Service 1182c4
  /* Tail of audit_strings[current_index] which still needs
Packit Service 1182c4
     processing.  */
Packit Service 1182c4
  const char *current_tail;
Packit Service 1182c4
Packit Service 1182c4
  /* Scratch buffer for returning a name which is part of the strings
Packit Service 1182c4
     in audit_strings.  */
Packit Service 1182c4
  char fname[SECURE_NAME_LIMIT];
Packit Service 1182c4
};
Packit Service 1182c4
Packit Service 1182c4
/* This is a list of all the modes the dynamic loader can be in.  */
Packit Service 1182c4
enum rtld_mode
Packit Service 1182c4
  {
Packit Service 1182c4
    rtld_mode_normal, rtld_mode_list, rtld_mode_verify, rtld_mode_trace,
Packit Service a5e7c5
    rtld_mode_help,
Packit Service 1182c4
  };
Packit Service 1182c4
Packit Service 1182c4
/* Aggregated state information extracted from environment variables
Packit Service 1182c4
   and the ld.so command line.  */
Packit Service 1182c4
struct dl_main_state
Packit Service 1182c4
{
Packit Service 1182c4
  struct audit_list audit_list;
Packit Service 1182c4
Packit Service 1182c4
  /* The library search path.  */
Packit Service 1182c4
  const char *library_path;
Packit Service 1182c4
Packit Service 1b38de
  /* Where library_path comes from.  LD_LIBRARY_PATH or --library-path.  */
Packit Service 1b38de
  const char *library_path_source;
Packit Service 1b38de
Packit Service 1182c4
  /* The list preloaded objects from LD_PRELOAD.  */
Packit Service 1182c4
  const char *preloadlist;
Packit Service 1182c4
Packit Service 1182c4
  /* The preload list passed as a command argument.  */
Packit Service 1182c4
  const char *preloadarg;
Packit Service 1182c4
Packit Service 96474a
  /* Additional glibc-hwcaps subdirectories to search first.
Packit Service 96474a
     Colon-separated list.  */
Packit Service 96474a
  const char *glibc_hwcaps_prepend;
Packit Service 96474a
Packit Service 96474a
  /* Mask for the internal glibc-hwcaps subdirectories.
Packit Service 96474a
     Colon-separated list.  */
Packit Service 96474a
  const char *glibc_hwcaps_mask;
Packit Service 96474a
Packit Service 1182c4
  enum rtld_mode mode;
Packit Service 1182c4
Packit Service 1182c4
  /* True if any of the debugging options is enabled.  */
Packit Service 1182c4
  bool any_debug;
Packit Service 1182c4
Packit Service 1182c4
  /* True if information about versions has to be printed.  */
Packit Service 1182c4
  bool version_info;
Packit Service 1182c4
};
Packit Service 1182c4
Packit Service 1182c4
/* Helper function to invoke _dl_init_paths with the right arguments
Packit Service 1182c4
   from *STATE.  */
Packit Service 1182c4
static inline void
Packit Service 1182c4
call_init_paths (const struct dl_main_state *state)
Packit Service 1182c4
{
Packit Service 96474a
  _dl_init_paths (state->library_path, state->library_path_source,
Packit Service 96474a
                  state->glibc_hwcaps_prepend, state->glibc_hwcaps_mask);
Packit Service 1182c4
}
Packit Service 1182c4
Packit Service ad9b00
/* Print ld.so usage information and exit.  */
Packit Service a5e7c5
_Noreturn void _dl_usage (const char *argv0, const char *wrong_option)
Packit Service a5e7c5
  attribute_hidden;
Packit Service a5e7c5
Packit Service 41d4d6
/* Print ld.so version information and exit.  */
Packit Service 41d4d6
_Noreturn void _dl_version (void) attribute_hidden;
Packit Service 41d4d6
Packit Service a5e7c5
/* Print ld.so --help output and exit.  */
Packit Service a5e7c5
_Noreturn void _dl_help (const char *argv0, struct dl_main_state *state)
Packit Service a5e7c5
  attribute_hidden;
Packit Service ad9b00
Packit Service 1182c4
#endif /* _DL_MAIN */