OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [newlib-1.18.0/] [newlib-1.18.0-or32-1.0rc2/] [newlib/] [libc/] [sys/] [linux/] [include/] [link.h] - Diff between revs 207 and 520

Only display areas with differences | Details | Blame | View Log

Rev 207 Rev 520
/* Data structure for communication from the run-time dynamic linker for
/* Data structure for communication from the run-time dynamic linker for
   loaded ELF shared objects.
   loaded ELF shared objects.
   Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
   Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
   This file is part of the GNU C Library.
   This file is part of the GNU C Library.
 
 
   The GNU C Library is free software; you can redistribute it and/or
   The GNU C Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.
   version 2.1 of the License, or (at your option) any later version.
 
 
   The GNU C Library is distributed in the hope that it will be useful,
   The GNU C Library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.
   Lesser General Public License for more details.
 
 
   You should have received a copy of the GNU Lesser General Public
   You should have received a copy of the GNU Lesser General Public
   License along with the GNU C Library; if not, write to the Free
   License along with the GNU C Library; if not, write to the Free
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   02111-1307 USA.  */
   02111-1307 USA.  */
 
 
#ifndef _LINK_H
#ifndef _LINK_H
#define _LINK_H 1
#define _LINK_H 1
 
 
#include <features.h>
#include <features.h>
#include <elf.h>
#include <elf.h>
#include <dlfcn.h>
#include <dlfcn.h>
#include <sys/types.h>
#include <sys/types.h>
 
 
#define DT_THISPROCNUM 0
#define DT_THISPROCNUM 0
/* We use this macro to refer to ELF types independent of the native wordsize.
/* We use this macro to refer to ELF types independent of the native wordsize.
   `ElfW(TYPE)' is used in place of `Elf32_TYPE' or `Elf64_TYPE'.  */
   `ElfW(TYPE)' is used in place of `Elf32_TYPE' or `Elf64_TYPE'.  */
#define ElfW(type)      _ElfW (Elf, __ELF_NATIVE_CLASS, type)
#define ElfW(type)      _ElfW (Elf, __ELF_NATIVE_CLASS, type)
#define _ElfW(e,w,t)    _ElfW_1 (e, w, _##t)
#define _ElfW(e,w,t)    _ElfW_1 (e, w, _##t)
#define _ElfW_1(e,w,t)  e##w##t
#define _ElfW_1(e,w,t)  e##w##t
 
 
#include <sys/elfclass.h>               /* Defines __ELF_NATIVE_CLASS.  */
#include <sys/elfclass.h>               /* Defines __ELF_NATIVE_CLASS.  */
#include <sys/link.h>
#include <sys/link.h>
#include <dl-lookupcfg.h>
#include <dl-lookupcfg.h>
 
 
/* Rendezvous structure used by the run-time dynamic linker to communicate
/* Rendezvous structure used by the run-time dynamic linker to communicate
   details of shared object loading to the debugger.  If the executable's
   details of shared object loading to the debugger.  If the executable's
   dynamic section has a DT_DEBUG element, the run-time linker sets that
   dynamic section has a DT_DEBUG element, the run-time linker sets that
   element's value to the address where this structure can be found.  */
   element's value to the address where this structure can be found.  */
 
 
struct r_debug
struct r_debug
  {
  {
    int r_version;              /* Version number for this protocol.  */
    int r_version;              /* Version number for this protocol.  */
 
 
    struct link_map *r_map;     /* Head of the chain of loaded objects.  */
    struct link_map *r_map;     /* Head of the chain of loaded objects.  */
 
 
    /* This is the address of a function internal to the run-time linker,
    /* This is the address of a function internal to the run-time linker,
       that will always be called when the linker begins to map in a
       that will always be called when the linker begins to map in a
       library or unmap it, and again when the mapping change is complete.
       library or unmap it, and again when the mapping change is complete.
       The debugger can set a breakpoint at this address if it wants to
       The debugger can set a breakpoint at this address if it wants to
       notice shared object mapping changes.  */
       notice shared object mapping changes.  */
    ElfW(Addr) r_brk;
    ElfW(Addr) r_brk;
    enum
    enum
      {
      {
        /* This state value describes the mapping change taking place when
        /* This state value describes the mapping change taking place when
           the `r_brk' address is called.  */
           the `r_brk' address is called.  */
        RT_CONSISTENT,          /* Mapping change is complete.  */
        RT_CONSISTENT,          /* Mapping change is complete.  */
        RT_ADD,                 /* Beginning to add a new object.  */
        RT_ADD,                 /* Beginning to add a new object.  */
        RT_DELETE               /* Beginning to remove an object mapping.  */
        RT_DELETE               /* Beginning to remove an object mapping.  */
      } r_state;
      } r_state;
 
 
    ElfW(Addr) r_ldbase;        /* Base address the linker is loaded at.  */
    ElfW(Addr) r_ldbase;        /* Base address the linker is loaded at.  */
  };
  };
 
 
/* This is the instance of that structure used by the dynamic linker.  */
/* This is the instance of that structure used by the dynamic linker.  */
extern struct r_debug _r_debug;
extern struct r_debug _r_debug;
 
 
/* This symbol refers to the "dynamic structure" in the `.dynamic' section
/* This symbol refers to the "dynamic structure" in the `.dynamic' section
   of whatever module refers to `_DYNAMIC'.  So, to find its own
   of whatever module refers to `_DYNAMIC'.  So, to find its own
   `struct r_debug', a program could do:
   `struct r_debug', a program could do:
     for (dyn = _DYNAMIC; dyn->d_tag != DT_NULL; ++dyn)
     for (dyn = _DYNAMIC; dyn->d_tag != DT_NULL; ++dyn)
       if (dyn->d_tag == DT_DEBUG)
       if (dyn->d_tag == DT_DEBUG)
         r_debug = (struct r_debug *) dyn->d_un.d_ptr;
         r_debug = (struct r_debug *) dyn->d_un.d_ptr;
   */
   */
extern ElfW(Dyn) _DYNAMIC[];
extern ElfW(Dyn) _DYNAMIC[];
 
 
 
 
/* Some internal data structures of the dynamic linker used in the
/* Some internal data structures of the dynamic linker used in the
   linker map.  We only provide forward declarations.  */
   linker map.  We only provide forward declarations.  */
struct libname_list;
struct libname_list;
struct r_found_version;
struct r_found_version;
struct r_search_path_elem;
struct r_search_path_elem;
 
 
/* Forward declaration.  */
/* Forward declaration.  */
struct link_map;
struct link_map;
 
 
/* Structure to describe a single list of scope elements.  The lookup
/* Structure to describe a single list of scope elements.  The lookup
   functions get passed an array of pointers to such structures.  */
   functions get passed an array of pointers to such structures.  */
struct r_scope_elem
struct r_scope_elem
{
{
  /* Array of maps for the scope.  */
  /* Array of maps for the scope.  */
  struct link_map **r_list;
  struct link_map **r_list;
  /* Number of entries in the scope.  */
  /* Number of entries in the scope.  */
  unsigned int r_nlist;
  unsigned int r_nlist;
};
};
 
 
 
 
/* Structure to record search path and allocation mechanism.  */
/* Structure to record search path and allocation mechanism.  */
struct r_search_path_struct
struct r_search_path_struct
  {
  {
    struct r_search_path_elem **dirs;
    struct r_search_path_elem **dirs;
    int malloced;
    int malloced;
  };
  };
 
 
 
 
/* Structure describing a loaded shared object.  The `l_next' and `l_prev'
/* Structure describing a loaded shared object.  The `l_next' and `l_prev'
   members form a chain of all the shared objects loaded at startup.
   members form a chain of all the shared objects loaded at startup.
 
 
   These data structures exist in space used by the run-time dynamic linker;
   These data structures exist in space used by the run-time dynamic linker;
   modifying them may have disastrous results.
   modifying them may have disastrous results.
 
 
   This data structure might change in future, if necessary.  User-level
   This data structure might change in future, if necessary.  User-level
   programs must avoid defining objects of this type.  */
   programs must avoid defining objects of this type.  */
 
 
struct link_map
struct link_map
  {
  {
    /* These first few members are part of the protocol with the debugger.
    /* These first few members are part of the protocol with the debugger.
       This is the same format used in SVR4.  */
       This is the same format used in SVR4.  */
 
 
    ElfW(Addr) l_addr;          /* Base address shared object is loaded at.  */
    ElfW(Addr) l_addr;          /* Base address shared object is loaded at.  */
    char *l_name;               /* Absolute file name object was found in.  */
    char *l_name;               /* Absolute file name object was found in.  */
    ElfW(Dyn) *l_ld;            /* Dynamic section of the shared object.  */
    ElfW(Dyn) *l_ld;            /* Dynamic section of the shared object.  */
    struct link_map *l_next, *l_prev; /* Chain of loaded objects.  */
    struct link_map *l_next, *l_prev; /* Chain of loaded objects.  */
 
 
    /* All following members are internal to the dynamic linker.
    /* All following members are internal to the dynamic linker.
       They may change without notice.  */
       They may change without notice.  */
 
 
    struct libname_list *l_libname;
    struct libname_list *l_libname;
    /* Indexed pointers to dynamic section.
    /* Indexed pointers to dynamic section.
       [0,DT_NUM) are indexed by the processor-independent tags.
       [0,DT_NUM) are indexed by the processor-independent tags.
       [DT_NUM,DT_NUM+DT_THISPROCNUM) are indexed by the tag minus DT_LOPROC.
       [DT_NUM,DT_NUM+DT_THISPROCNUM) are indexed by the tag minus DT_LOPROC.
       [DT_NUM+DT_THISPROCNUM,DT_NUM+DT_THISPROCNUM+DT_EXTRANUM) are indexed
       [DT_NUM+DT_THISPROCNUM,DT_NUM+DT_THISPROCNUM+DT_EXTRANUM) are indexed
       by DT_EXTRATAGIDX(tagvalue) and
       by DT_EXTRATAGIDX(tagvalue) and
       [DT_NUM+DT_THISPROCNUM+DT_VERSIONTAGNUM,
       [DT_NUM+DT_THISPROCNUM+DT_VERSIONTAGNUM,
        DT_NUM+DT_THISPROCNUM+DT_VERSIONTAGNUM+DT_EXTRANUM)
        DT_NUM+DT_THISPROCNUM+DT_VERSIONTAGNUM+DT_EXTRANUM)
       are indexed by DT_EXTRATAGIDX(tagvalue) (see <elf.h>).  */
       are indexed by DT_EXTRATAGIDX(tagvalue) (see <elf.h>).  */
 
 
    ElfW(Dyn) *l_info[DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM
    ElfW(Dyn) *l_info[DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM
                     + DT_EXTRANUM];
                     + DT_EXTRANUM];
    const ElfW(Phdr) *l_phdr;   /* Pointer to program header table in core.  */
    const ElfW(Phdr) *l_phdr;   /* Pointer to program header table in core.  */
    ElfW(Addr) l_entry;         /* Entry point location.  */
    ElfW(Addr) l_entry;         /* Entry point location.  */
    ElfW(Half) l_phnum;         /* Number of program header entries.  */
    ElfW(Half) l_phnum;         /* Number of program header entries.  */
    ElfW(Half) l_ldnum; /* Number of dynamic segment entries.  */
    ElfW(Half) l_ldnum; /* Number of dynamic segment entries.  */
 
 
    /* Array of DT_NEEDED dependencies and their dependencies, in
    /* Array of DT_NEEDED dependencies and their dependencies, in
       dependency order for symbol lookup (with and without
       dependency order for symbol lookup (with and without
       duplicates).  There is no entry before the dependencies have
       duplicates).  There is no entry before the dependencies have
       been loaded.  */
       been loaded.  */
    struct r_scope_elem l_searchlist;
    struct r_scope_elem l_searchlist;
 
 
    /* We need a special searchlist to process objects marked with
    /* We need a special searchlist to process objects marked with
       DT_SYMBOLIC.  */
       DT_SYMBOLIC.  */
    struct r_scope_elem l_symbolic_searchlist;
    struct r_scope_elem l_symbolic_searchlist;
 
 
    /* Dependent object that first caused this object to be loaded.  */
    /* Dependent object that first caused this object to be loaded.  */
    struct link_map *l_loader;
    struct link_map *l_loader;
 
 
    /* Symbol hash table.  */
    /* Symbol hash table.  */
    Elf_Symndx l_nbuckets;
    Elf_Symndx l_nbuckets;
    const Elf_Symndx *l_buckets, *l_chain;
    const Elf_Symndx *l_buckets, *l_chain;
 
 
    unsigned int l_opencount;   /* Reference count for dlopen/dlclose.  */
    unsigned int l_opencount;   /* Reference count for dlopen/dlclose.  */
    enum                        /* Where this object came from.  */
    enum                        /* Where this object came from.  */
      {
      {
        lt_executable,          /* The main executable program.  */
        lt_executable,          /* The main executable program.  */
        lt_library,             /* Library needed by main executable.  */
        lt_library,             /* Library needed by main executable.  */
        lt_loaded               /* Extra run-time loaded shared object.  */
        lt_loaded               /* Extra run-time loaded shared object.  */
      } l_type:2;
      } l_type:2;
    unsigned int l_relocated:1; /* Nonzero if object's relocations done.  */
    unsigned int l_relocated:1; /* Nonzero if object's relocations done.  */
    unsigned int l_init_called:1; /* Nonzero if DT_INIT function called.  */
    unsigned int l_init_called:1; /* Nonzero if DT_INIT function called.  */
    unsigned int l_global:1;    /* Nonzero if object in _dl_global_scope.  */
    unsigned int l_global:1;    /* Nonzero if object in _dl_global_scope.  */
    unsigned int l_reserved:2;  /* Reserved for internal use.  */
    unsigned int l_reserved:2;  /* Reserved for internal use.  */
    unsigned int l_phdr_allocated:1; /* Nonzero if the data structure pointed
    unsigned int l_phdr_allocated:1; /* Nonzero if the data structure pointed
                                        to by `l_phdr' is allocated.  */
                                        to by `l_phdr' is allocated.  */
    unsigned int l_soname_added:1; /* Nonzero if the SONAME is for sure in
    unsigned int l_soname_added:1; /* Nonzero if the SONAME is for sure in
                                      the l_libname list.  */
                                      the l_libname list.  */
    unsigned int l_faked:1;     /* Nonzero if this is a faked descriptor
    unsigned int l_faked:1;     /* Nonzero if this is a faked descriptor
                                   without associated file.  */
                                   without associated file.  */
 
 
    /* Array with version names.  */
    /* Array with version names.  */
    unsigned int l_nversions;
    unsigned int l_nversions;
    struct r_found_version *l_versions;
    struct r_found_version *l_versions;
 
 
    /* Collected information about own RPATH directories.  */
    /* Collected information about own RPATH directories.  */
    struct r_search_path_struct l_rpath_dirs;
    struct r_search_path_struct l_rpath_dirs;
 
 
    /* Collected results of relocation while profiling.  */
    /* Collected results of relocation while profiling.  */
    ElfW(Addr) *l_reloc_result;
    ElfW(Addr) *l_reloc_result;
 
 
    /* Pointer to the version information if available.  */
    /* Pointer to the version information if available.  */
    ElfW(Versym) *l_versyms;
    ElfW(Versym) *l_versyms;
 
 
    /* String specifying the path where this object was found.  */
    /* String specifying the path where this object was found.  */
    const char *l_origin;
    const char *l_origin;
 
 
    /* Start and finish of memory map for this object.  l_map_start
    /* Start and finish of memory map for this object.  l_map_start
       need not be the same as l_addr.  */
       need not be the same as l_addr.  */
    ElfW(Addr) l_map_start, l_map_end;
    ElfW(Addr) l_map_start, l_map_end;
 
 
    /* Default array for 'l_scope'.  */
    /* Default array for 'l_scope'.  */
    struct r_scope_elem *l_scope_mem[4];
    struct r_scope_elem *l_scope_mem[4];
    /* Size of array allocated for 'l_scope'.  */
    /* Size of array allocated for 'l_scope'.  */
    size_t l_scope_max;
    size_t l_scope_max;
    /* This is an array defining the lookup scope for this link map.
    /* This is an array defining the lookup scope for this link map.
       There are at most three different scope lists.  */
       There are at most three different scope lists.  */
    struct r_scope_elem **l_scope;
    struct r_scope_elem **l_scope;
 
 
    /* A similar array, this time only with the local scope.  This is
    /* A similar array, this time only with the local scope.  This is
       used occasionally.  */
       used occasionally.  */
    struct r_scope_elem *l_local_scope[2];
    struct r_scope_elem *l_local_scope[2];
 
 
    /* This information is kept to check for sure whether a shared
    /* This information is kept to check for sure whether a shared
       object is the same as one already loaded.  */
       object is the same as one already loaded.  */
    dev_t l_dev;
    dev_t l_dev;
    ino64_t l_ino;
    ino64_t l_ino;
 
 
    /* Collected information about own RUNPATH directories.  */
    /* Collected information about own RUNPATH directories.  */
    struct r_search_path_struct l_runpath_dirs;
    struct r_search_path_struct l_runpath_dirs;
 
 
    /* List of object in order of the init and fini calls.  */
    /* List of object in order of the init and fini calls.  */
    struct link_map **l_initfini;
    struct link_map **l_initfini;
 
 
    /* List of the dependencies introduced through symbol binding.  */
    /* List of the dependencies introduced through symbol binding.  */
    unsigned int l_reldepsmax;
    unsigned int l_reldepsmax;
    unsigned int l_reldepsact;
    unsigned int l_reldepsact;
    struct link_map **l_reldeps;
    struct link_map **l_reldeps;
 
 
    /* Various flag words.  */
    /* Various flag words.  */
    ElfW(Word) l_feature_1;
    ElfW(Word) l_feature_1;
    ElfW(Word) l_flags_1;
    ElfW(Word) l_flags_1;
 
 
    /* Temporarily used in `dl_close'.  */
    /* Temporarily used in `dl_close'.  */
    unsigned int l_idx;
    unsigned int l_idx;
 
 
    struct link_map_machine l_mach;
    struct link_map_machine l_mach;
 
 
    struct
    struct
    {
    {
      const ElfW(Sym) *sym;
      const ElfW(Sym) *sym;
      int type_class;
      int type_class;
#ifdef DL_LOOKUP_RETURNS_MAP
#ifdef DL_LOOKUP_RETURNS_MAP
      struct link_map *value;
      struct link_map *value;
#else
#else
      ElfW(Addr) value;
      ElfW(Addr) value;
#endif
#endif
      const ElfW(Sym) *ret;
      const ElfW(Sym) *ret;
    } l_lookup_cache;
    } l_lookup_cache;
  };
  };
 
 
struct dl_phdr_info
struct dl_phdr_info
  {
  {
    ElfW(Addr) dlpi_addr;
    ElfW(Addr) dlpi_addr;
    const char *dlpi_name;
    const char *dlpi_name;
    const ElfW(Phdr) *dlpi_phdr;
    const ElfW(Phdr) *dlpi_phdr;
    ElfW(Half) dlpi_phnum;
    ElfW(Half) dlpi_phnum;
  };
  };
 
 
extern int dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info,
extern int dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info,
                                             size_t size, void *data),
                                             size_t size, void *data),
                            void *data);
                            void *data);
extern int __dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info,
extern int __dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info,
                                               size_t size, void *data),
                                               size_t size, void *data),
                              void *data);
                              void *data);
 
 
#endif /* link.h */
#endif /* link.h */
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.