Update.
[platform/upstream/glibc.git] / sysdeps / generic / ldsodefs.h
1 /* Run-time dynamic linker data structures for loaded ELF shared objects.
2    Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
4
5    The GNU C Library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9
10    The GNU C Library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library; if not, write to the Free
17    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18    02111-1307 USA.  */
19
20 #ifndef _LDSODEFS_H
21 #define _LDSODEFS_H     1
22
23 #include <features.h>
24
25 #define __need_size_t
26 #define __need_NULL
27 #include <stddef.h>
28 #include <string.h>
29
30 #include <elf.h>
31 #include <dlfcn.h>
32 #include <fpu_control.h>
33 #include <sys/mman.h>
34 #include <link.h>
35 #include <dl-lookupcfg.h>
36 #include <bits/libc-lock.h>
37 #include <hp-timing.h>
38 #include <tls.h>
39
40 __BEGIN_DECLS
41
42 /* We use this macro to refer to ELF types independent of the native wordsize.
43    `ElfW(TYPE)' is used in place of `Elf32_TYPE' or `Elf64_TYPE'.  */
44 #define ELFW(type)      _ElfW (ELF, __ELF_NATIVE_CLASS, type)
45
46 /* All references to the value of l_info[DT_PLTGOT],
47   l_info[DT_STRTAB], l_info[DT_SYMTAB], l_info[DT_RELA],
48   l_info[DT_REL], l_info[DT_JMPREL], and l_info[VERSYMIDX (DT_VERSYM)]
49   have to be accessed via the D_PTR macro.  The macro is needed since for
50   most architectures the entry is already relocated - but for some not
51   and we need to relocate at access time.  */
52 #ifdef DL_RO_DYN_SECTION
53 # define D_PTR(map,i) (map->i->d_un.d_ptr + map->l_addr)
54 #else
55 # define D_PTR(map,i) map->i->d_un.d_ptr
56 #endif
57
58 /* On some platforms more information than just the address of the symbol
59    is needed from the lookup functions.  In this case we return the whole
60    link map.  */
61 #ifdef DL_LOOKUP_RETURNS_MAP
62 typedef struct link_map *lookup_t;
63 # define LOOKUP_VALUE(map) map
64 # define LOOKUP_VALUE_ADDRESS(map) (map ? map->l_addr : 0)
65 #else
66 typedef ElfW(Addr) lookup_t;
67 # define LOOKUP_VALUE(map) map->l_addr
68 # define LOOKUP_VALUE_ADDRESS(address) address
69 #endif
70
71 /* on some architectures a pointer to a function is not just a pointer
72    to the actual code of the function but rather an architecture
73    specific descriptor. */
74 #ifndef ELF_FUNCTION_PTR_IS_SPECIAL
75 # define DL_SYMBOL_ADDRESS(map, ref) \
76  (void *) (LOOKUP_VALUE_ADDRESS (map) + ref->st_value)
77 # define DL_LOOKUP_ADDRESS(addr) ((ElfW(Addr)) (addr))
78 # define DL_DT_INIT_ADDRESS(map, start) (start)
79 # define DL_DT_FINI_ADDRESS(map, start) (start)
80 #endif
81
82 /* Unmap a loaded object, called by _dl_close (). */
83 #ifndef DL_UNMAP_IS_SPECIAL
84 # define DL_UNMAP(map) \
85  __munmap ((void *) (map)->l_map_start,                                       \
86            (map)->l_map_end - (map)->l_map_start)
87 #endif
88
89 /* By default we do not need special support to initialize DSOs loaded
90    by statically linked binaries.  */
91 #ifndef DL_STATIC_INIT
92 # define DL_STATIC_INIT(map)
93 #endif
94
95 /* Reloc type classes as returned by elf_machine_type_class().
96    ELF_RTYPE_CLASS_PLT means this reloc should not be satisfied by
97    some PLT symbol, ELF_RTYPE_CLASS_COPY means this reloc should not be
98    satisfied by any symbol in the executable.  */
99 #define ELF_RTYPE_CLASS_PLT 1
100 #define ELF_RTYPE_CLASS_COPY 2
101
102 /* ELF uses the PF_x macros to specify the segment permissions, mmap
103    uses PROT_xxx.  In most cases the three macros have the values 1, 2,
104    and 3 but not in a matching order.  The following macros allows
105    converting from the PF_x values to PROT_xxx values.  */
106 #define PF_TO_PROT \
107   ((PROT_READ << (PF_R * 4))                                                  \
108    | (PROT_WRITE << (PF_W * 4))                                               \
109    | (PROT_EXEC << (PF_X * 4))                                                \
110    | ((PROT_READ | PROT_WRITE) << ((PF_R | PF_W) * 4))                        \
111    | ((PROT_READ | PROT_EXEC) << ((PF_R | PF_X) * 4))                         \
112    | ((PROT_WRITE | PROT_EXEC) << (PF_W | PF_X) * 4)                          \
113    | ((PROT_READ | PROT_WRITE | PROT_EXEC) << ((PF_R | PF_W | PF_X) * 4)))
114
115
116 /* For the version handling we need an array with only names and their
117    hash values.  */
118 struct r_found_version
119   {
120     const char *name;
121     ElfW(Word) hash;
122
123     int hidden;
124     const char *filename;
125   };
126
127 /* We want to cache information about the searches for shared objects.  */
128
129 enum r_dir_status { unknown, nonexisting, existing };
130
131 struct r_search_path_elem
132   {
133     /* This link is only used in the `all_dirs' member of `r_search_path'.  */
134     struct r_search_path_elem *next;
135
136     /* Strings saying where the definition came from.  */
137     const char *what;
138     const char *where;
139
140     /* Basename for this search path element.  The string must end with
141        a slash character.  */
142     const char *dirname;
143     size_t dirnamelen;
144
145     enum r_dir_status status[0];
146   };
147
148 struct r_strlenpair
149   {
150     const char *str;
151     size_t len;
152   };
153
154
155 /* A data structure for a simple single linked list of strings.  */
156 struct libname_list
157   {
158     const char *name;           /* Name requested (before search).  */
159     struct libname_list *next;  /* Link to next name for this object.  */
160     int dont_free;              /* Flag whether this element should be freed
161                                    if the object is not entirely unloaded.  */
162   };
163
164
165 /* Test whether given NAME matches any of the names of the given object.  */
166 static __inline int
167 __attribute__ ((unused))
168 _dl_name_match_p (const char *__name, struct link_map *__map)
169 {
170   int __found = strcmp (__name, __map->l_name) == 0;
171   struct libname_list *__runp = __map->l_libname;
172
173   while (! __found && __runp != NULL)
174     if (strcmp (__name, __runp->name) == 0)
175       __found = 1;
176     else
177       __runp = __runp->next;
178
179   return __found;
180 }
181
182 /* Function used as argument for `_dl_receive_error' function.  The
183    arguments are the error code, error string, and the objname the
184    error occurred in.  */
185 typedef void (*receiver_fct) (int, const char *, const char *);
186 \f
187 /* Internal functions of the run-time dynamic linker.
188    These can be accessed if you link again the dynamic linker
189    as a shared library, as in `-lld' or `/lib/ld.so' explicitly;
190    but are not normally of interest to user programs.
191
192    The `-ldl' library functions in <dlfcn.h> provide a simple
193    user interface to run-time dynamic linking.  */
194
195
196 #ifndef SHARED
197 # define EXTERN extern
198 # define GL(name) _##name
199 #else
200 # define EXTERN
201 # define GL(name) _rtld_global._##name
202 struct rtld_global
203 {
204 #endif
205   /* Don't change the order of the following elements.  'dl_loaded'
206      must remain the first element.  Forever.  */
207
208   /* And a pointer to the map for the main map.  */
209   EXTERN struct link_map *_dl_loaded;
210   /* Number of object in the _dl_loaded list.  */
211   EXTERN unsigned int _dl_nloaded;
212   /* Array representing global scope.  */
213   EXTERN struct r_scope_elem *_dl_global_scope[2];
214   /* Direct pointer to the searchlist of the main object.  */
215   EXTERN struct r_scope_elem *_dl_main_searchlist;
216   /* Copy of the content of `_dl_main_searchlist'.  */
217   EXTERN struct r_scope_elem _dl_initial_searchlist;
218   /* This is zero at program start to signal that the global scope map is
219      allocated by rtld.  Later it keeps the size of the map.  It might be
220      reset if in _dl_close if the last global object is removed.  */
221   EXTERN size_t _dl_global_scope_alloc;
222
223   /* If nonzero the appropriate debug information is printed.  */
224   EXTERN int _dl_debug_mask;
225 #define DL_DEBUG_LIBS       (1 << 0)
226 #define DL_DEBUG_IMPCALLS   (1 << 1)
227 #define DL_DEBUG_BINDINGS   (1 << 2)
228 #define DL_DEBUG_SYMBOLS    (1 << 3)
229 #define DL_DEBUG_VERSIONS   (1 << 4)
230 #define DL_DEBUG_RELOC      (1 << 5)
231 #define DL_DEBUG_FILES      (1 << 6)
232 #define DL_DEBUG_STATISTICS (1 << 7)
233 /* This one is used only internally.  */
234 #define DL_DEBUG_HELP       (1 << 8)
235 #define DL_DEBUG_PRELINK    (1 << 9)
236
237   /* Cached value of `getpagesize ()'.  */
238   EXTERN size_t _dl_pagesize;
239
240   /* During the program run we must not modify the global data of
241      loaded shared object simultanously in two threads.  Therefore we
242      protect `_dl_open' and `_dl_close' in dl-close.c.
243
244      This must be a recursive lock since the initializer function of
245      the loaded object might as well require a call to this function.
246      At this time it is not anymore a problem to modify the tables.  */
247   __libc_lock_define_recursive (EXTERN, _dl_load_lock)
248
249   /* OS version.  */
250   EXTERN unsigned int _dl_osversion;
251   /* Platform name.  */
252   EXTERN const char *_dl_platform;
253   EXTERN size_t _dl_platformlen;
254
255 #ifndef MAP_ANON
256   /* File descriptor referring to the zero-fill device.  */
257   EXTERN int _dl_zerofd;
258 #endif
259
260   /* CLK_TCK as reported by the kernel.  */
261   EXTERN int _dl_clktck;
262
263   /* If nonzero print warnings messages.  */
264   EXTERN int _dl_verbose;
265
266   /* Do we do lazy relocations?  */
267   EXTERN int _dl_lazy;
268
269   /* Nonzero if runtime lookups should not update the .got/.plt.  */
270   EXTERN int _dl_bind_not;
271
272   /* Nonzero if references should be treated as weak during runtime
273      linking.  */
274   EXTERN int _dl_dynamic_weak;
275
276   /* Default floating-point control word.  */
277   EXTERN fpu_control_t _dl_fpu_control;
278
279   /* The object to be initialized first.  */
280   EXTERN struct link_map *_dl_initfirst;
281
282 #if HP_TIMING_AVAIL
283   /* Start time on CPU clock.  */
284   EXTERN hp_timing_t _dl_cpuclock_offset;
285
286   /* Overhead of a high-precision timing measurement.  */
287   EXTERN hp_timing_t _dl_hp_timing_overhead;
288 #endif
289
290 #ifdef USE_TLS
291   /* Offset of the TLS block for ld.so from the thread-pointer.  */
292   EXTERN size_t _rtld_tlsoffset;
293 #endif
294
295   /* Name of the shared object to be profiled (if any).  */
296   EXTERN const char *_dl_profile;
297   /* Map of shared object to be profiled.  */
298   EXTERN struct link_map *_dl_profile_map;
299   /* Filename of the output file.  */
300   EXTERN const char *_dl_profile_output;
301   /* Map of shared object to be prelink traced.  */
302   EXTERN struct link_map *_dl_trace_prelink_map;
303   /* Name of the object we want to trace the prelinking.  */
304   EXTERN const char *_dl_trace_prelink;
305
306   /* Expected cache ID.  */
307   EXTERN int _dl_correct_cache_id;
308
309   /* Counters for the number of relocations performed.  */
310   EXTERN unsigned long int _dl_num_relocations;
311   EXTERN unsigned long int _dl_num_cache_relocations;
312
313   /* Mask for hardware capabilities that are available.  */
314   EXTERN unsigned long int _dl_hwcap;
315
316   /* Mask for important hardware capabilities we honour. */
317   EXTERN unsigned long int _dl_hwcap_mask;
318
319   /* Names of shared object for which the RPATH should be ignored.  */
320   EXTERN const char *_dl_inhibit_rpath;
321
322   /* Location of the binary.  */
323   EXTERN const char *_dl_origin_path;
324
325   /* List of search directories.  */
326   EXTERN struct r_search_path_elem *_dl_all_dirs;
327   EXTERN struct r_search_path_elem *_dl_init_all_dirs;
328
329   /* File descriptor to write debug messages to.  */
330   EXTERN int _dl_debug_fd;
331
332   /* Get architecture specific definitions.  */
333 #define PROCINFO_DECL
334 #include <dl-procinfo.c>
335
336   /* Structure describing the dynamic linker itself.  */
337   EXTERN struct link_map _dl_rtld_map;
338 #ifdef SHARED
339 };
340 extern struct rtld_global _rtld_global;
341 #endif
342 #undef EXTERN
343
344 /* Parameters passed to the dynamic linker.  */
345 extern int _dl_argc;
346 extern char **_dl_argv;
347
348 /* The array with message we print as a last resort.  */
349 extern const char _dl_out_of_memory[];
350
351
352 /* OS-dependent function to open the zero-fill device.  */
353 extern int _dl_sysdep_open_zero_fill (void); /* dl-sysdep.c */
354
355
356 /* Write message on the debug file descriptor.  The parameters are
357    interpreted as for a `printf' call.  All the lines start with a
358    tag showing the PID.  */
359 extern void _dl_debug_printf (const char *fmt, ...)
360      __attribute__ ((__format__ (__printf__, 1, 2)));
361 extern void _dl_debug_printf_internal (const char *fmt, ...)
362      __attribute__ ((__format__ (__printf__, 1, 2)));
363
364 /* Write message on the debug file descriptor.  The parameters are
365    interpreted as for a `printf' call.  All the lines buf the first
366    start with a tag showing the PID.  */
367 extern void _dl_debug_printf_c (const char *fmt, ...)
368      __attribute__ ((__format__ (__printf__, 1, 2)));
369
370
371 /* Write a message on the specified descriptor FD.  The parameters are
372    interpreted as for a `printf' call.  */
373 extern void _dl_dprintf (int fd, const char *fmt, ...)
374      __attribute__ ((__format__ (__printf__, 2, 3)));
375
376 /* Write a message on the specified descriptor standard output.  The
377    parameters are interpreted as for a `printf' call.  */
378 #define _dl_printf(fmt, args...) \
379   _dl_dprintf (STDOUT_FILENO, fmt, ##args)
380
381 /* Write a message on the specified descriptor standard error.  The
382    parameters are interpreted as for a `printf' call.  */
383 #define _dl_error_printf(fmt, args...) \
384   _dl_dprintf (STDERR_FILENO, fmt, ##args)
385
386 /* Write a message on the specified descriptor standard error and exit
387    the program.  The parameters are interpreted as for a `printf' call.  */
388 #define _dl_fatal_printf(fmt, args...) \
389   do                                                                          \
390     {                                                                         \
391       _dl_dprintf (STDERR_FILENO, fmt, ##args);                               \
392       _exit (127);                                                            \
393     }                                                                         \
394   while (1)
395
396
397 /* This function is called by all the internal dynamic linker functions
398    when they encounter an error.  ERRCODE is either an `errno' code or
399    zero; OBJECT is the name of the problematical shared object, or null if
400    it is a general problem; ERRSTRING is a string describing the specific
401    problem.  */
402 extern void _dl_signal_error (int errcode, const char *object,
403                               const char *occurred, const char *errstring)
404      internal_function
405      __attribute__ ((__noreturn__));
406 extern void _dl_signal_error_internal (int errcode, const char *object,
407                                        const char *occurred,
408                                        const char *errstring)
409      internal_function
410      __attribute__ ((__noreturn__));
411
412 /* Like _dl_signal_error, but may return when called in the context of
413    _dl_receive_error.  */
414 extern void _dl_signal_cerror (int errcode, const char *object,
415                                const char *occation, const char *errstring)
416      internal_function;
417
418 /* Call OPERATE, receiving errors from `dl_signal_cerror'.  Unlike
419    `_dl_catch_error' the operation is resumed after the OPERATE
420    function returns.
421    ARGS is passed as argument to OPERATE.  */
422 extern void _dl_receive_error (receiver_fct fct, void (*operate) (void *),
423                                void *args)
424      internal_function;
425
426
427 /* Open the shared object NAME and map in its segments.
428    LOADER's DT_RPATH is used in searching for NAME.
429    If the object is already opened, returns its existing map.
430    For preloaded shared objects PRELOADED is set to a non-zero
431    value to allow additional security checks.  */
432 extern struct link_map *_dl_map_object (struct link_map *loader,
433                                         const char *name, int preloaded,
434                                         int type, int trace_mode, int mode)
435      internal_function;
436 extern struct link_map *_dl_map_object_internal (struct link_map *loader,
437                                                  const char *name,
438                                                  int preloaded,
439                                                  int type, int trace_mode,
440                                                  int mode)
441      internal_function;
442
443 /* Call _dl_map_object on the dependencies of MAP, and set up
444    MAP->l_searchlist.  PRELOADS points to a vector of NPRELOADS previously
445    loaded objects that will be inserted into MAP->l_searchlist after MAP
446    but before its dependencies.  */
447 extern void _dl_map_object_deps (struct link_map *map,
448                                  struct link_map **preloads,
449                                  unsigned int npreloads, int trace_mode)
450      internal_function;
451 extern void _dl_map_object_deps_internal (struct link_map *map,
452                                           struct link_map **preloads,
453                                           unsigned int npreloads,
454                                           int trace_mode)
455      internal_function;
456
457 /* Cache the locations of MAP's hash table.  */
458 extern void _dl_setup_hash (struct link_map *map) internal_function;
459
460
461 /* Search loaded objects' symbol tables for a definition of the symbol
462    referred to by UNDEF.  *SYM is the symbol table entry containing the
463    reference; it is replaced with the defining symbol, and the base load
464    address of the defining object is returned.  SYMBOL_SCOPE is a
465    null-terminated list of object scopes to search; each object's
466    l_searchlist (i.e. the segment of the dependency tree starting at that
467    object) is searched in turn.  REFERENCE_NAME should name the object
468    containing the reference; it is used in error messages.
469    TYPE_CLASS describes the type of symbol we are looking for.  */
470 extern lookup_t _dl_lookup_symbol (const char *undef,
471                                    struct link_map *undef_map,
472                                    const ElfW(Sym) **sym,
473                                    struct r_scope_elem *symbol_scope[],
474                                    int type_class, int explicit)
475      internal_function;
476 extern lookup_t _dl_lookup_symbol_internal (const char *undef,
477                                             struct link_map *undef_map,
478                                             const ElfW(Sym) **sym,
479                                             struct r_scope_elem *symbol_scope[],
480                                             int type_class, int explicit)
481      internal_function;
482
483 /* Lookup versioned symbol.  */
484 extern lookup_t _dl_lookup_versioned_symbol (const char *undef,
485                                              struct link_map *undef_map,
486                                              const ElfW(Sym) **sym,
487                                              struct r_scope_elem *symbol_scope[],
488                                              const struct r_found_version *version,
489                                              int type_class, int explicit)
490      internal_function;
491 extern lookup_t _dl_lookup_versioned_symbol_internal (const char *undef,
492                                                       struct link_map *undef_map,
493                                                       const ElfW(Sym) **sym,
494                                                       struct r_scope_elem *symbol_scope[],
495                                                       const struct r_found_version *version,
496                                                       int type_class,
497                                                       int explicit)
498      internal_function;
499
500 /* For handling RTLD_NEXT we must be able to skip shared objects.  */
501 extern lookup_t _dl_lookup_symbol_skip (const char *undef,
502                                         struct link_map *undef_map,
503                                         const ElfW(Sym) **sym,
504                                         struct r_scope_elem *symbol_scope[],
505                                         struct link_map *skip_this)
506      internal_function;
507
508 /* For handling RTLD_NEXT with versioned symbols we must be able to
509    skip shared objects.  */
510 extern lookup_t _dl_lookup_versioned_symbol_skip (const char *undef,
511                                                   struct link_map *undef_map,
512                                                   const ElfW(Sym) **sym,
513                                                   struct r_scope_elem *symbol_scope[],
514                                                   const struct r_found_version *version,
515                                                   struct link_map *skip_this)
516      internal_function;
517
518 /* Look up symbol NAME in MAP's scope and return its run-time address.  */
519 extern ElfW(Addr) _dl_symbol_value (struct link_map *map, const char *name)
520      internal_function;
521
522 /* Allocate a `struct link_map' for a new object being loaded,
523    and enter it into the _dl_main_map list.  */
524 extern struct link_map *_dl_new_object (char *realname, const char *libname,
525                                         int type, struct link_map *loader)
526      internal_function;
527
528 /* Relocate the given object (if it hasn't already been).
529    SCOPE is passed to _dl_lookup_symbol in symbol lookups.
530    If LAZY is nonzero, don't relocate its PLT.  */
531 extern void _dl_relocate_object (struct link_map *map,
532                                  struct r_scope_elem *scope[],
533                                  int lazy, int consider_profiling);
534 extern void _dl_relocate_object_internal (struct link_map *map,
535                                           struct r_scope_elem *scope[],
536                                           int lazy, int consider_profiling);
537
538 /* Call _dl_signal_error with a message about an unhandled reloc type.
539    TYPE is the result of ELFW(R_TYPE) (r_info), i.e. an R_<CPU>_* value.
540    PLT is nonzero if this was a PLT reloc; it just affects the message.  */
541 extern void _dl_reloc_bad_type (struct link_map *map,
542                                 unsigned int type, int plt)
543      internal_function __attribute__ ((__noreturn__));
544
545 /* Resolve conflicts if prelinking.  */
546 extern void _dl_resolve_conflicts (struct link_map *l,
547                                    ElfW(Rela) *conflict,
548                                    ElfW(Rela) *conflictend);
549
550 /* Check the version dependencies of all objects available through
551    MAP.  If VERBOSE print some more diagnostics.  */
552 extern int _dl_check_all_versions (struct link_map *map, int verbose,
553                                    int trace_mode)
554      internal_function;
555
556 /* Check the version dependencies for MAP.  If VERBOSE print some more
557    diagnostics.  */
558 extern int _dl_check_map_versions (struct link_map *map, int verbose,
559                                    int trace_mode)
560      internal_function;
561
562 /* Initialize the object in SCOPE by calling the constructors with
563    ARGC, ARGV, and ENV as the parameters.  */
564 extern void _dl_init (struct link_map *main_map, int argc, char **argv,
565                       char **env) internal_function;
566
567 /* Call the finalizer functions of all shared objects whose
568    initializer functions have completed.  */
569 extern void _dl_fini (void) internal_function;
570
571 /* The dynamic linker calls this function before and having changing
572    any shared object mappings.  The `r_state' member of `struct r_debug'
573    says what change is taking place.  This function's address is
574    the value of the `r_brk' member.  */
575 extern void _dl_debug_state (void);
576 extern void _dl_debug_state_internal (void);
577
578 /* Initialize `struct r_debug' if it has not already been done.  The
579    argument is the run-time load address of the dynamic linker, to be put
580    in the `r_ldbase' member.  Returns the address of the structure.  */
581 extern struct r_debug *_dl_debug_initialize (ElfW(Addr) ldbase)
582      internal_function;
583
584 /* Initialize the basic data structure for the search paths.  */
585 extern void _dl_init_paths (const char *library_path) internal_function;
586
587 /* Gather the information needed to install the profiling tables and start
588    the timers.  */
589 extern void _dl_start_profile (struct link_map *map, const char *output_dir)
590      internal_function;
591 extern void _dl_start_profile_internal (struct link_map *map,
592                                         const char *output_dir)
593      internal_function;
594
595 /* The actual functions used to keep book on the calls.  */
596 extern void _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc);
597
598 /* This function is simply a wrapper around the _dl_mcount function
599    which does not require a FROMPC parameter since this is the
600    calling function.  */
601 extern void _dl_mcount_wrapper (void *selfpc);
602
603 /* Show the members of the auxiliary array passed up from the kernel.  */
604 extern void _dl_show_auxv (void) internal_function;
605
606 /* Return all environment variables starting with `LD_', one after the
607    other.  */
608 extern char *_dl_next_ld_env_entry (char ***position) internal_function;
609
610 /* Return an array with the names of the important hardware capabilities.  */
611 extern const struct r_strlenpair *_dl_important_hwcaps (const char *platform,
612                                                         size_t paltform_len,
613                                                         size_t *sz,
614                                                         size_t *max_capstrlen)
615      internal_function;
616
617 /* Look up NAME in ld.so.cache and return the file name stored there,
618    or null if none is found.  */
619 extern const char *_dl_load_cache_lookup (const char *name)
620      internal_function;
621
622 /* If the system does not support MAP_COPY we cannot leave the file open
623    all the time since this would create problems when the file is replaced.
624    Therefore we provide this function to close the file and open it again
625    once needed.  */
626 extern void _dl_unload_cache (void);
627 extern void _dl_unload_cache_internal (void);
628
629 /* System-dependent function to read a file's whole contents in the
630    most convenient manner available.  *SIZEP gets the size of the
631    file.  On error MAP_FAILED is returned.  */
632 extern void *_dl_sysdep_read_whole_file (const char *file, size_t *sizep,
633                                          int prot)
634      internal_function;
635
636 /* System-specific function to do initial startup for the dynamic linker.
637    After this, file access calls and getenv must work.  This is responsible
638    for setting __libc_enable_secure if we need to be secure (e.g. setuid),
639    and for setting _dl_argc and _dl_argv, and then calling _dl_main.  */
640 extern ElfW(Addr) _dl_sysdep_start (void **start_argptr,
641                                     void (*dl_main) (const ElfW(Phdr) *phdr,
642                                                      ElfW(Word) phnum,
643                                                      ElfW(Addr) *user_entry));
644
645 extern void _dl_sysdep_start_cleanup (void)
646      internal_function;
647
648
649 __END_DECLS
650
651 #endif /* ldsodefs.h */