Back to index

glibc  2.9
Defines | Functions
dl-vdso.h File Reference
#include <assert.h>
#include <ldsodefs.h>
#include <dl-hash.h>

Go to the source code of this file.

Defines

#define CHECK_HASH(var)   assert (var.hash == _dl_elf_hash (var.name))
#define PREPARE_VERSION(var, vname, vhash)

Functions

void * _dl_vdso_vsym (const char *name, const struct r_found_version *version) internal_function attribute_hidden

Define Documentation

#define CHECK_HASH (   var)    assert (var.hash == _dl_elf_hash (var.name))

Definition at line 30 of file dl-vdso.h.

#define PREPARE_VERSION (   var,
  vname,
  vhash 
)
Value:
struct r_found_version var;                                          \
  var.name = vname;                                                  \
  var.hidden = 1;                                                    \
  var.hash = vhash;                                                  \
  CHECK_HASH (var);                                                  \
  /* We don't have a specific file where the symbol can be found.  */       \
  var.filename = NULL

Definition at line 34 of file dl-vdso.h.


Function Documentation

void* _dl_vdso_vsym ( const char *  name,
const struct r_found_version version 
)

Definition at line 26 of file dl-vdso.c.

{
  struct link_map *map = GLRO (dl_sysinfo_map);
  void *value = NULL;


  if (map != NULL)
    {
      /* Use a WEAK REF so we don't error out if the symbol is not found.  */
      ElfW (Sym) wsym;
      memset (&wsym, 0, sizeof (ElfW (Sym)));
      wsym.st_info = (unsigned char) ELFW (ST_INFO (STB_WEAK, STT_NOTYPE));

      /* Search the scope of the vdso map.  */
      const ElfW (Sym) *ref = &wsym;
      lookup_t result = GLRO (dl_lookup_symbol_x) (name, map, &ref,
                                             map->l_local_scope,
                                             vers, 0, 0, NULL);

      if (ref != NULL)
       value = DL_SYMBOL_ADDRESS (result, ref);
    }

  return value;
}