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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [uClibc/] [include/] [link.h] - Blame information for rev 1325

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1325 phoenix
/* Data structure for communication from the run-time dynamic linker for
2
   loaded ELF shared objects.
3
   Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
4
   This file is part of the GNU C Library.
5
 
6
   The GNU C Library is free software; you can redistribute it and/or
7
   modify it under the terms of the GNU Lesser General Public
8
   License as published by the Free Software Foundation; either
9
   version 2.1 of the License, or (at your option) any later version.
10
 
11
   The GNU C Library is distributed in the hope that it will be useful,
12
   but WITHOUT ANY WARRANTY; without even the implied warranty of
13
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
   Lesser General Public License for more details.
15
 
16
   You should have received a copy of the GNU Lesser General Public
17
   License along with the GNU C Library; if not, write to the Free
18
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19
   02111-1307 USA.  */
20
 
21
#ifndef _LINK_H
22
#define _LINK_H 1
23
 
24
#include <features.h>
25
#include <elf.h>
26
#include <dlfcn.h>
27
#include <sys/types.h>
28
 
29
/* We use this macro to refer to ELF types independent of the native wordsize.
30
   `ElfW(TYPE)' is used in place of `Elf32_TYPE' or `Elf64_TYPE'.  */
31
#define ElfW(type)      _ElfW (Elf, __ELF_NATIVE_CLASS, type)
32
#define _ElfW(e,w,t)    _ElfW_1 (e, w, _##t)
33
#define _ElfW_1(e,w,t)  e##w##t
34
 
35
#include <bits/elfclass.h>              /* Defines __ELF_NATIVE_CLASS.  */
36
 
37
/* Rendezvous structure used by the run-time dynamic linker to communicate
38
   details of shared object loading to the debugger.  If the executable's
39
   dynamic section has a DT_DEBUG element, the run-time linker sets that
40
   element's value to the address where this structure can be found.  */
41
 
42
struct r_debug
43
  {
44
    int r_version;              /* Version number for this protocol.  */
45
 
46
    struct link_map *r_map;     /* Head of the chain of loaded objects.  */
47
 
48
    /* This is the address of a function internal to the run-time linker,
49
       that will always be called when the linker begins to map in a
50
       library or unmap it, and again when the mapping change is complete.
51
       The debugger can set a breakpoint at this address if it wants to
52
       notice shared object mapping changes.  */
53
    ElfW(Addr) r_brk;
54
    enum
55
      {
56
        /* This state value describes the mapping change taking place when
57
           the `r_brk' address is called.  */
58
        RT_CONSISTENT,          /* Mapping change is complete.  */
59
        RT_ADD,                 /* Beginning to add a new object.  */
60
        RT_DELETE               /* Beginning to remove an object mapping.  */
61
      } r_state;
62
 
63
    ElfW(Addr) r_ldbase;        /* Base address the linker is loaded at.  */
64
  };
65
 
66
/* This is the instance of that structure used by the dynamic linker.  */
67
extern struct r_debug _r_debug;
68
 
69
/* This symbol refers to the "dynamic structure" in the `.dynamic' section
70
   of whatever module refers to `_DYNAMIC'.  So, to find its own
71
   `struct r_debug', a program could do:
72
     for (dyn = _DYNAMIC; dyn->d_tag != DT_NULL; ++dyn)
73
       if (dyn->d_tag == DT_DEBUG)
74
         r_debug = (struct r_debug *) dyn->d_un.d_ptr;
75
   */
76
extern ElfW(Dyn) _DYNAMIC[];
77
 
78
/* Structure describing a loaded shared object.  The `l_next' and `l_prev'
79
   members form a chain of all the shared objects loaded at startup.
80
 
81
   These data structures exist in space used by the run-time dynamic linker;
82
   modifying them may have disastrous results.  */
83
 
84
struct link_map
85
  {
86
    /* These first few members are part of the protocol with the debugger.
87
       This is the same format used in SVR4.  */
88
 
89
    ElfW(Addr) l_addr;          /* Base address shared object is loaded at.  */
90
    char *l_name;               /* Absolute file name object was found in.  */
91
    ElfW(Dyn) *l_ld;            /* Dynamic section of the shared object.  */
92
    struct link_map *l_next, *l_prev; /* Chain of loaded objects.  */
93
  };
94
 
95
#ifdef __USE_GNU
96
 
97
struct dl_phdr_info
98
  {
99
    ElfW(Addr) dlpi_addr;
100
    const char *dlpi_name;
101
    const ElfW(Phdr) *dlpi_phdr;
102
    ElfW(Half) dlpi_phnum;
103
  };
104
 
105
__BEGIN_DECLS
106
 
107
extern int dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info,
108
                                             size_t size, void *data),
109
                            void *data) __THROW;
110
 
111
__END_DECLS
112
 
113
#endif
114
 
115
#endif /* link.h */

powered by: WebSVN 2.1.0

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