Back to index

glibc  2.9
dl-lookupcfg.h
Go to the documentation of this file.
00001 /* Configuration of lookup functions.
00002    Copyright (C) 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 #define ELF_FUNCTION_PTR_IS_SPECIAL
00021 #define DL_UNMAP_IS_SPECIAL
00022 
00023 #include <dl-fptr.h>
00024 
00025 /* We do not support copy relocations for IA-64.  */
00026 #define DL_NO_COPY_RELOCS
00027 
00028 /* Forward declaration.  */
00029 struct link_map;
00030 
00031 extern void *_dl_symbol_address (struct link_map *map, const Elf64_Sym *ref);
00032 
00033 #define DL_SYMBOL_ADDRESS(map, ref) _dl_symbol_address(map, ref)
00034 
00035 extern Elf64_Addr _dl_lookup_address (const void *address);
00036 
00037 #define DL_LOOKUP_ADDRESS(addr) _dl_lookup_address (addr)
00038 
00039 extern void _dl_unmap (struct link_map *map);
00040 
00041 #define DL_UNMAP(map) _dl_unmap (map)
00042 
00043 #define DL_AUTO_FUNCTION_ADDRESS(map, addr)             \
00044 ({                                               \
00045   unsigned long int fptr[2];                            \
00046   fptr[0] = (unsigned long int) (addr);                 \
00047   fptr[1] = (map)->l_info[DT_PLTGOT]->d_un.d_ptr;       \
00048   (Elf64_Addr) fptr;                             \
00049 })
00050 
00051 #define DL_STATIC_FUNCTION_ADDRESS(map, addr)           \
00052 ({                                               \
00053   static unsigned long int fptr[2];                     \
00054   fptr[0] = (unsigned long int) (addr);                 \
00055   fptr[1] = (map)->l_info[DT_PLTGOT]->d_un.d_ptr;       \
00056   (Elf64_Addr) fptr;                             \
00057 })
00058 
00059 #define DL_DT_INIT_ADDRESS(map, addr) DL_AUTO_FUNCTION_ADDRESS (map, addr)
00060 #define DL_DT_FINI_ADDRESS(map, addr) DL_AUTO_FUNCTION_ADDRESS (map, addr)
00061 /* The type of the return value of fixup/profile_fixup.  */
00062 #define DL_FIXUP_VALUE_TYPE struct fdesc
00063 /* Construct a value of type DL_FIXUP_VALUE_TYPE from a code address
00064    and a link map.  */
00065 #define DL_FIXUP_MAKE_VALUE(map, addr) \
00066   ((struct fdesc) { (addr), (map)->l_info[DT_PLTGOT]->d_un.d_ptr })
00067 /* Extract the code address from a value of type DL_FIXUP_MAKE_VALUE.
00068  */
00069 #define DL_FIXUP_VALUE_CODE_ADDR(value) (value).ip
00070 
00071 #define DL_FIXUP_VALUE_ADDR(value) ((uintptr_t) &(value))
00072 #define DL_FIXUP_ADDR_VALUE(addr) (*(struct fdesc *) (addr))