2000-05-05 15:15:29 +08:00
|
|
|
/* Configuration of lookup functions.
|
2005-01-07 06:40:27 +08:00
|
|
|
Copyright (C) 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
|
2000-05-05 15:15:29 +08:00
|
|
|
This file is part of the GNU C Library.
|
|
|
|
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
2001-07-06 12:58:11 +08:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
2000-05-05 15:15:29 +08:00
|
|
|
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2001-07-06 12:58:11 +08:00
|
|
|
Lesser General Public License for more details.
|
2000-05-05 15:15:29 +08:00
|
|
|
|
2001-07-06 12:58:11 +08:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with the GNU C Library; if not, write to the Free
|
|
|
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
|
|
02111-1307 USA. */
|
2000-05-05 15:15:29 +08:00
|
|
|
|
|
|
|
#define ELF_FUNCTION_PTR_IS_SPECIAL
|
2000-09-27 03:13:37 +08:00
|
|
|
#define DL_UNMAP_IS_SPECIAL
|
2000-05-22 05:15:00 +08:00
|
|
|
|
2005-02-08 06:56:07 +08:00
|
|
|
#include <dl-fptr.h>
|
|
|
|
|
2003-03-27 09:16:50 +08:00
|
|
|
/* We do not support copy relocations for IA-64. */
|
|
|
|
#define DL_NO_COPY_RELOCS
|
|
|
|
|
2001-08-27 08:59:51 +08:00
|
|
|
/* Forward declaration. */
|
|
|
|
struct link_map;
|
|
|
|
|
2003-03-03 17:45:09 +08:00
|
|
|
extern void *_dl_symbol_address (struct link_map *map, const Elf64_Sym *ref);
|
2000-05-22 05:15:00 +08:00
|
|
|
|
|
|
|
#define DL_SYMBOL_ADDRESS(map, ref) _dl_symbol_address(map, ref)
|
2000-09-27 03:13:37 +08:00
|
|
|
|
2000-11-17 02:15:26 +08:00
|
|
|
extern Elf64_Addr _dl_lookup_address (const void *address);
|
2000-09-27 03:13:37 +08:00
|
|
|
|
|
|
|
#define DL_LOOKUP_ADDRESS(addr) _dl_lookup_address (addr)
|
|
|
|
|
2000-11-17 02:15:26 +08:00
|
|
|
extern void _dl_unmap (struct link_map *map);
|
2000-09-27 03:13:37 +08:00
|
|
|
|
|
|
|
#define DL_UNMAP(map) _dl_unmap (map)
|
2000-11-17 02:15:26 +08:00
|
|
|
|
2001-07-26 08:27:15 +08:00
|
|
|
#define DL_AUTO_FUNCTION_ADDRESS(map, addr) \
|
|
|
|
({ \
|
2002-01-30 08:38:09 +08:00
|
|
|
unsigned long int fptr[2]; \
|
|
|
|
fptr[0] = (unsigned long int) (addr); \
|
2001-07-26 08:27:15 +08:00
|
|
|
fptr[1] = (map)->l_info[DT_PLTGOT]->d_un.d_ptr; \
|
|
|
|
(Elf64_Addr) fptr; \
|
|
|
|
})
|
|
|
|
|
|
|
|
#define DL_STATIC_FUNCTION_ADDRESS(map, addr) \
|
|
|
|
({ \
|
2002-01-30 08:38:09 +08:00
|
|
|
static unsigned long int fptr[2]; \
|
|
|
|
fptr[0] = (unsigned long int) (addr); \
|
2001-07-26 08:27:15 +08:00
|
|
|
fptr[1] = (map)->l_info[DT_PLTGOT]->d_un.d_ptr; \
|
|
|
|
(Elf64_Addr) fptr; \
|
|
|
|
})
|
|
|
|
|
|
|
|
#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)
|
2005-02-08 06:56:07 +08:00
|
|
|
/* The type of the return value of fixup/profile_fixup. */
|
|
|
|
#define DL_FIXUP_VALUE_TYPE struct fdesc
|
|
|
|
/* Construct a value of type DL_FIXUP_VALUE_TYPE from a code address
|
|
|
|
and a link map. */
|
|
|
|
#define DL_FIXUP_MAKE_VALUE(map, addr) \
|
|
|
|
((struct fdesc) { (addr), (map)->l_info[DT_PLTGOT]->d_un.d_ptr })
|
|
|
|
/* Extract the code address from a value of type DL_FIXUP_MAKE_VALUE.
|
|
|
|
*/
|
|
|
|
#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))
|