Back to index

glibc  2.9
Defines | Functions
dl-lookupcfg.h File Reference
#include <dl-fptr.h>

Go to the source code of this file.

Defines

#define ELF_FUNCTION_PTR_IS_SPECIAL
#define DL_UNMAP_IS_SPECIAL
#define DL_NO_COPY_RELOCS
#define DL_SYMBOL_ADDRESS(map, ref)   _dl_symbol_address(map, ref)
#define DL_LOOKUP_ADDRESS(addr)   _dl_lookup_address (addr)
#define DL_UNMAP(map)   _dl_unmap (map)
#define DL_AUTO_FUNCTION_ADDRESS(map, addr)
#define DL_STATIC_FUNCTION_ADDRESS(map, addr)
#define DL_DT_INIT_ADDRESS(map, addr)   DL_AUTO_FUNCTION_ADDRESS (map, addr)
#define DL_DT_FINI_ADDRESS(map, addr)   DL_AUTO_FUNCTION_ADDRESS (map, addr)
#define DL_FIXUP_VALUE_TYPE   struct fdesc
#define DL_FIXUP_MAKE_VALUE(map, addr)   ((struct fdesc) { (addr), (map)->l_info[DT_PLTGOT]->d_un.d_ptr })
#define DL_FIXUP_VALUE_CODE_ADDR(value)   (value).ip
#define DL_FIXUP_VALUE_ADDR(value)   ((uintptr_t) &(value))
#define DL_FIXUP_ADDR_VALUE(addr)   (*(struct fdesc *) (addr))

Functions

void * _dl_symbol_address (struct link_map *map, const Elf64_Sym *ref)
Elf64_Addr _dl_lookup_address (const void *address)
void _dl_unmap (struct link_map *map)

Define Documentation

#define DL_AUTO_FUNCTION_ADDRESS (   map,
  addr 
)
Value:
({                                               \
  unsigned long int fptr[2];                            \
  fptr[0] = (unsigned long int) (addr);                 \
  fptr[1] = (map)->l_info[DT_PLTGOT]->d_un.d_ptr;       \
  (Elf64_Addr) fptr;                             \
})

Definition at line 43 of file dl-lookupcfg.h.

Definition at line 60 of file dl-lookupcfg.h.

Definition at line 59 of file dl-lookupcfg.h.

#define DL_FIXUP_ADDR_VALUE (   addr)    (*(struct fdesc *) (addr))

Definition at line 72 of file dl-lookupcfg.h.

#define DL_FIXUP_MAKE_VALUE (   map,
  addr 
)    ((struct fdesc) { (addr), (map)->l_info[DT_PLTGOT]->d_un.d_ptr })

Definition at line 65 of file dl-lookupcfg.h.

#define DL_FIXUP_VALUE_ADDR (   value)    ((uintptr_t) &(value))

Definition at line 71 of file dl-lookupcfg.h.

#define DL_FIXUP_VALUE_CODE_ADDR (   value)    (value).ip

Definition at line 69 of file dl-lookupcfg.h.

#define DL_FIXUP_VALUE_TYPE   struct fdesc

Definition at line 62 of file dl-lookupcfg.h.

Definition at line 37 of file dl-lookupcfg.h.

Definition at line 26 of file dl-lookupcfg.h.

#define DL_STATIC_FUNCTION_ADDRESS (   map,
  addr 
)
Value:
({                                               \
  static unsigned long int fptr[2];                     \
  fptr[0] = (unsigned long int) (addr);                 \
  fptr[1] = (map)->l_info[DT_PLTGOT]->d_un.d_ptr;       \
  (Elf64_Addr) fptr;                             \
})

Definition at line 51 of file dl-lookupcfg.h.

#define DL_SYMBOL_ADDRESS (   map,
  ref 
)    _dl_symbol_address(map, ref)

Definition at line 33 of file dl-lookupcfg.h.

#define DL_UNMAP (   map)    _dl_unmap (map)

Definition at line 41 of file dl-lookupcfg.h.

Definition at line 21 of file dl-lookupcfg.h.

Definition at line 20 of file dl-lookupcfg.h.


Function Documentation

Elf64_Addr _dl_lookup_address ( const void *  address)
void* _dl_symbol_address ( struct link_map map,
const Elf64_Sym ref 
)
void _dl_unmap ( struct link_map map)

Definition at line 267 of file dl-fptr.c.

{
  ElfW(Addr) *ftab = map->l_mach.fptr_table;
  struct fdesc *head = NULL, *tail = NULL;
  size_t i;

  __munmap ((void *) map->l_map_start,
           map->l_map_end - map->l_map_start);

  if (ftab == NULL)
    return;

  /* String together the fdesc structures that are being freed.  */
  for (i = 0; i < map->l_mach.fptr_table_len; ++i)
    {
      if (ftab[i])
       {
         *(struct fdesc **) ftab[i] = head;
         head = (struct fdesc *) ftab[i];
         if (tail == NULL)
           tail = head;
       }
    }

  /* Prepend the new list to the free_list: */
  if (tail)
    do
      tail->ip = (ElfW(Addr)) local.free_list;
    while (! COMPARE_AND_SWAP ((ElfW(Addr) *) &local.free_list,
                            tail->ip, (ElfW(Addr)) head));

  __munmap (ftab, (map->l_mach.fptr_table_len
                 * sizeof (map->l_mach.fptr_table[0])));

  map->l_mach.fptr_table = NULL;
}