Blame sysdeps/hppa/dl-lookupcfg.h

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
/* Forward declaration.  */
Packit 6c4009
struct link_map;
Packit 6c4009
Packit 6c4009
void *_dl_symbol_address (struct link_map *map, const ElfW(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
Elf32_Addr _dl_lookup_address (const void *address);
Packit 6c4009
Packit 6c4009
#define DL_LOOKUP_ADDRESS(addr) _dl_lookup_address ((const void *) addr)
Packit 6c4009
Packit 6c4009
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 int fptr[2];					\
Packit 6c4009
 /* The test for "start & 2" below is to accommodate old binaries which	\
Packit 6c4009
    violated the ELF ABI by pointing DT_INIT and DT_FINI at a function	\
Packit 6c4009
    descriptor.  */							\
Packit 6c4009
  if ((ElfW(Addr)) (start) & 2)						\
Packit 6c4009
    addr = (ElfW(Addr)) start;						\
Packit 6c4009
  else									\
Packit 6c4009
    {									\
Packit 6c4009
      fptr[0] = (unsigned int) (start);					\
Packit 6c4009
      fptr[1] = (map)->l_info[DT_PLTGOT]->d_un.d_ptr;			\
Packit 6c4009
      /* Set bit 30 to indicate to $$dyncall that this is a PLABEL. */	\
Packit 6c4009
      addr = (ElfW(Addr))((unsigned int)fptr | 2);			\
Packit 6c4009
    }									\
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
Packit 6c4009
/* Construct a fixup value from the address and linkmap */
Packit 6c4009
#define DL_FIXUP_MAKE_VALUE(map, addr) \
Packit 6c4009
  (map) ? ((struct fdesc) { (addr), (map)->l_info[DT_PLTGOT]->d_un.d_ptr }) \
Packit 6c4009
	: ((struct fdesc) { 0, 0 })
Packit 6c4009
Packit 6c4009
/* Extract the code address from a fixup value */
Packit 6c4009
#define DL_FIXUP_VALUE_CODE_ADDR(value) ((value).ip)
Packit 6c4009
#define DL_FIXUP_VALUE_ADDR(value) ((uintptr_t) &(value))
Packit 6c4009
#define DL_FIXUP_ADDR_VALUE(addr) (*(struct fdesc *) (addr))