|
Packit |
6c4009 |
/* Configuration of lookup functions.
|
|
Packit |
6c4009 |
Copyright (C) 2000-2018 Free Software Foundation, Inc.
|
|
Packit |
6c4009 |
This file is part of the GNU C Library.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit |
6c4009 |
modify it under the terms of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License as published by the Free Software Foundation; either
|
|
Packit |
6c4009 |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit |
6c4009 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
6c4009 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
6c4009 |
Lesser General Public License for more details.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
You should have received a copy of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License along with the GNU C Library; if not, see
|
|
Packit |
6c4009 |
<http://www.gnu.org/licenses/>. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define ELF_FUNCTION_PTR_IS_SPECIAL
|
|
Packit |
6c4009 |
#define DL_UNMAP_IS_SPECIAL
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#include <dl-fptr.h>
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* We do not support copy relocations for IA-64. */
|
|
Packit |
6c4009 |
#define DL_NO_COPY_RELOCS
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Forward declaration. */
|
|
Packit |
6c4009 |
struct link_map;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
extern void *_dl_symbol_address (struct link_map *map, const Elf64_Sym *ref);
|
|
Packit |
6c4009 |
rtld_hidden_proto (_dl_symbol_address)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define DL_SYMBOL_ADDRESS(map, ref) _dl_symbol_address(map, ref)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
extern Elf64_Addr _dl_lookup_address (const void *address);
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define DL_LOOKUP_ADDRESS(addr) _dl_lookup_address (addr)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
extern void attribute_hidden _dl_unmap (struct link_map *map);
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define DL_UNMAP(map) _dl_unmap (map)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define DL_DT_FUNCTION_ADDRESS(map, start, attr, addr) \
|
|
Packit |
6c4009 |
attr volatile unsigned long int fptr[2]; \
|
|
Packit |
6c4009 |
fptr[0] = (unsigned long int) (start); \
|
|
Packit |
6c4009 |
fptr[1] = (map)->l_info[DT_PLTGOT]->d_un.d_ptr; \
|
|
Packit |
6c4009 |
addr = (ElfW(Addr)) fptr; \
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define DL_CALL_DT_INIT(map, start, argc, argv, env) \
|
|
Packit |
6c4009 |
{ \
|
|
Packit |
6c4009 |
ElfW(Addr) addr; \
|
|
Packit |
6c4009 |
DL_DT_FUNCTION_ADDRESS(map, start, , addr) \
|
|
Packit |
6c4009 |
init_t init = (init_t) addr; \
|
|
Packit |
6c4009 |
init (argc, argv, env); \
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define DL_CALL_DT_FINI(map, start) \
|
|
Packit |
6c4009 |
{ \
|
|
Packit |
6c4009 |
ElfW(Addr) addr; \
|
|
Packit |
6c4009 |
DL_DT_FUNCTION_ADDRESS(map, start, , addr) \
|
|
Packit |
6c4009 |
fini_t fini = (fini_t) addr; \
|
|
Packit |
6c4009 |
fini (); \
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* The type of the return value of fixup/profile_fixup. */
|
|
Packit |
6c4009 |
#define DL_FIXUP_VALUE_TYPE struct fdesc
|
|
Packit |
6c4009 |
/* Construct a value of type DL_FIXUP_VALUE_TYPE from a code address
|
|
Packit |
6c4009 |
and a link map. */
|
|
Packit |
6c4009 |
#define DL_FIXUP_MAKE_VALUE(map, addr) \
|
|
Packit |
6c4009 |
((struct fdesc) { (addr), (map)->l_info[DT_PLTGOT]->d_un.d_ptr })
|
|
Packit |
6c4009 |
/* Extract the code address from a value of type DL_FIXUP_MAKE_VALUE.
|
|
Packit |
6c4009 |
*/
|
|
Packit |
6c4009 |
#define DL_FIXUP_VALUE_CODE_ADDR(value) (value).ip
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define DL_FIXUP_VALUE_ADDR(value) ((uintptr_t) &(value))
|
|
Packit |
6c4009 |
#define DL_FIXUP_ADDR_VALUE(addr) (*(struct fdesc *) (addr))
|