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_SYMBOL_ADDRESS(map, ref)   _dl_symbol_address(map, ref)
#define DL_LOOKUP_ADDRESS(addr)   (_dl_lookup_address ((void *)((unsigned long)addr & ~3)))
#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)   ((Elf32_Addr)(addr) & 2 ? (addr) : DL_AUTO_FUNCTION_ADDRESS (map, addr))
#define DL_DT_FINI_ADDRESS(map, addr)   ((Elf32_Addr)(addr) & 2 ? (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 ElfW(Sym)*ref)
Elf32_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 int fptr[2];                                               \
  fptr[0] = (unsigned int) (addr);                             \
  fptr[1] = (map)->l_info[DT_PLTGOT]->d_un.d_ptr;                     \
  /* Set bit 30 to indicate to $$dyncall that this is a PLABEL. */    \
  (ElfW(Addr))((unsigned int)fptr | 2);                               \
})

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

#define DL_DT_FINI_ADDRESS (   map,
  addr 
)    ((Elf32_Addr)(addr) & 2 ? (addr) : DL_AUTO_FUNCTION_ADDRESS (map, addr))

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

#define DL_DT_INIT_ADDRESS (   map,
  addr 
)    ((Elf32_Addr)(addr) & 2 ? (addr) : DL_AUTO_FUNCTION_ADDRESS (map, addr))

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

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

Definition at line 79 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 73 of file dl-lookupcfg.h.

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

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

#define DL_FIXUP_VALUE_CODE_ADDR (   value)    ((value).ip)

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

#define DL_FIXUP_VALUE_TYPE   struct fdesc

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

#define DL_LOOKUP_ADDRESS (   addr)    (_dl_lookup_address ((void *)((unsigned long)addr & ~3)))

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

#define DL_STATIC_FUNCTION_ADDRESS (   map,
  addr 
)
Value:
({                                                             \
  static unsigned int fptr[2];                                        \
  fptr[0] = (unsigned int) (addr);                             \
  fptr[1] = (map)->l_info[DT_PLTGOT]->d_un.d_ptr;                     \
  /* Set bit 30 to indicate to $$dyncall that this is a PLABEL. */    \
  (ElfW(Addr))((unsigned int)fptr | 2);                               \
})

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

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

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

#define DL_UNMAP (   map)    _dl_unmap (map)

Definition at line 40 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

Elf32_Addr _dl_lookup_address ( const void *  address)
void* _dl_symbol_address ( struct link_map map,
const ElfW(Sym)*  ref 
)

Definition at line 24 of file dl-symaddr.c.

{
  ElfW(Addr) value = (map ? map->l_addr : 0) + ref->st_value;

  /* Return the pointer to function descriptor. */
  if (ELFW(ST_TYPE) (ref->st_info) == STT_FUNC)
    return (void *) _dl_make_fptr (map, ref, value);
  else
    return (void *) value;
}
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;
}