Blame sysdeps/mips/ldsodefs.h

Packit Service 82fcde
/* Run-time dynamic linker data structures for loaded ELF shared objects.
Packit Service 82fcde
   Copyright (C) 2000-2018 Free Software Foundation, Inc.
Packit Service 82fcde
   This file is part of the GNU C Library.
Packit Service 82fcde
Packit Service 82fcde
   The GNU C Library is free software; you can redistribute it and/or
Packit Service 82fcde
   modify it under the terms of the GNU Lesser General Public
Packit Service 82fcde
   License as published by the Free Software Foundation; either
Packit Service 82fcde
   version 2.1 of the License, or (at your option) any later version.
Packit Service 82fcde
Packit Service 82fcde
   The GNU C Library is distributed in the hope that it will be useful,
Packit Service 82fcde
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 82fcde
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 82fcde
   Lesser General Public License for more details.
Packit Service 82fcde
Packit Service 82fcde
   You should have received a copy of the GNU Lesser General Public
Packit Service 82fcde
   License along with the GNU C Library.  If not, see
Packit Service 82fcde
   <http://www.gnu.org/licenses/>.  */
Packit Service 82fcde
Packit Service 82fcde
#ifndef _MIPS_LDSODEFS_H
Packit Service 82fcde
#define _MIPS_LDSODEFS_H 1
Packit Service 82fcde
Packit Service 82fcde
#include <elf.h>
Packit Service 82fcde
Packit Service 82fcde
struct La_mips_32_regs;
Packit Service 82fcde
struct La_mips_32_retval;
Packit Service 82fcde
struct La_mips_64_regs;
Packit Service 82fcde
struct La_mips_64_retval;
Packit Service 82fcde
Packit Service 82fcde
#define ARCH_PLTENTER_MEMBERS						    \
Packit Service 82fcde
    Elf32_Addr (*mips_o32_gnu_pltenter) (Elf32_Sym *, unsigned int,	    \
Packit Service 82fcde
					 uintptr_t *, uintptr_t *,	    \
Packit Service 82fcde
					 struct La_mips_32_regs *,	    \
Packit Service 82fcde
					 unsigned int *, const char *name,  \
Packit Service 82fcde
					 long int *framesizep);		    \
Packit Service 82fcde
    Elf32_Addr (*mips_n32_gnu_pltenter) (Elf32_Sym *, unsigned int,	    \
Packit Service 82fcde
					 uintptr_t *, uintptr_t *,	    \
Packit Service 82fcde
					 struct La_mips_64_regs *,	    \
Packit Service 82fcde
					 unsigned int *, const char *name,  \
Packit Service 82fcde
					 long int *framesizep);		    \
Packit Service 82fcde
    Elf64_Addr (*mips_n64_gnu_pltenter) (Elf64_Sym *, unsigned int,	    \
Packit Service 82fcde
					 uintptr_t *, uintptr_t *,	    \
Packit Service 82fcde
					 struct La_mips_64_regs *,	    \
Packit Service 82fcde
					 unsigned int *, const char *name,  \
Packit Service 82fcde
					 long int *framesizep);
Packit Service 82fcde
Packit Service 82fcde
#define ARCH_PLTEXIT_MEMBERS						    \
Packit Service 82fcde
    unsigned int (*mips_o32_gnu_pltexit) (Elf32_Sym *, unsigned int,	    \
Packit Service 82fcde
					  uintptr_t *, uintptr_t *,	    \
Packit Service 82fcde
					  const struct La_mips_32_regs *,   \
Packit Service 82fcde
					  struct La_mips_32_retval *,	    \
Packit Service 82fcde
					  const char *);		    \
Packit Service 82fcde
    unsigned int (*mips_n32_gnu_pltexit) (Elf32_Sym *, unsigned int,	    \
Packit Service 82fcde
					  uintptr_t *, uintptr_t *,	    \
Packit Service 82fcde
					  const struct La_mips_64_regs *,   \
Packit Service 82fcde
					  struct La_mips_64_retval *,	    \
Packit Service 82fcde
					  const char *);		    \
Packit Service 82fcde
    unsigned int (*mips_n64_gnu_pltexit) (Elf64_Sym *, unsigned int,	    \
Packit Service 82fcde
					  uintptr_t *, uintptr_t *,	    \
Packit Service 82fcde
					  const struct La_mips_64_regs *,   \
Packit Service 82fcde
					  struct La_mips_64_retval *,	    \
Packit Service 82fcde
					  const char *);
Packit Service 82fcde
Packit Service 82fcde
/* The MIPS ABI specifies that the dynamic section has to be read-only.  */
Packit Service 82fcde
Packit Service 82fcde
#define DL_RO_DYN_SECTION 1
Packit Service 82fcde
Packit Service 82fcde
#include_next <ldsodefs.h>
Packit Service 82fcde
Packit Service 82fcde
/* The 64-bit MIPS ELF ABI uses an unusual reloc format.  Each
Packit Service 82fcde
   relocation entry specifies up to three actual relocations, all at
Packit Service 82fcde
   the same address.  The first relocation which required a symbol
Packit Service 82fcde
   uses the symbol in the r_sym field.  The second relocation which
Packit Service 82fcde
   requires a symbol uses the symbol in the r_ssym field.  If all
Packit Service 82fcde
   three relocations require a symbol, the third one uses a zero
Packit Service 82fcde
   value.
Packit Service 82fcde
Packit Service 82fcde
   We define these structures in internal headers because we're not
Packit Service 82fcde
   sure we want to make them part of the ABI yet.  Eventually, some of
Packit Service 82fcde
   this may move into elf/elf.h.  */
Packit Service 82fcde
Packit Service 82fcde
/* An entry in a 64 bit SHT_REL section.  */
Packit Service 82fcde
Packit Service 82fcde
typedef struct
Packit Service 82fcde
{
Packit Service 82fcde
  Elf32_Word    r_sym;		/* Symbol index */
Packit Service 82fcde
  unsigned char r_ssym;		/* Special symbol for 2nd relocation */
Packit Service 82fcde
  unsigned char r_type3;	/* 3rd relocation type */
Packit Service 82fcde
  unsigned char r_type2;	/* 2nd relocation type */
Packit Service 82fcde
  unsigned char r_type1;	/* 1st relocation type */
Packit Service 82fcde
} _Elf64_Mips_R_Info;
Packit Service 82fcde
Packit Service 82fcde
typedef union
Packit Service 82fcde
{
Packit Service 82fcde
  Elf64_Xword	r_info_number;
Packit Service 82fcde
  _Elf64_Mips_R_Info r_info_fields;
Packit Service 82fcde
} _Elf64_Mips_R_Info_union;
Packit Service 82fcde
Packit Service 82fcde
typedef struct
Packit Service 82fcde
{
Packit Service 82fcde
  Elf64_Addr	r_offset;		/* Address */
Packit Service 82fcde
  _Elf64_Mips_R_Info_union r_info;	/* Relocation type and symbol index */
Packit Service 82fcde
} Elf64_Mips_Rel;
Packit Service 82fcde
Packit Service 82fcde
typedef struct
Packit Service 82fcde
{
Packit Service 82fcde
  Elf64_Addr	r_offset;		/* Address */
Packit Service 82fcde
  _Elf64_Mips_R_Info_union r_info;	/* Relocation type and symbol index */
Packit Service 82fcde
  Elf64_Sxword	r_addend;		/* Addend */
Packit Service 82fcde
} Elf64_Mips_Rela;
Packit Service 82fcde
Packit Service 82fcde
#define ELF64_MIPS_R_SYM(i) \
Packit Service 82fcde
  ((__extension__ (_Elf64_Mips_R_Info_union)(i)).r_info_fields.r_sym)
Packit Service 82fcde
#define ELF64_MIPS_R_TYPE(i) \
Packit Service 82fcde
  (((_Elf64_Mips_R_Info_union)(i)).r_info_fields.r_type1 \
Packit Service 82fcde
   | ((Elf32_Word)(__extension__ (_Elf64_Mips_R_Info_union)(i) \
Packit Service 82fcde
		   ).r_info_fields.r_type2 << 8) \
Packit Service 82fcde
   | ((Elf32_Word)(__extension__ (_Elf64_Mips_R_Info_union)(i) \
Packit Service 82fcde
		   ).r_info_fields.r_type3 << 16) \
Packit Service 82fcde
   | ((Elf32_Word)(__extension__ (_Elf64_Mips_R_Info_union)(i) \
Packit Service 82fcde
		   ).r_info_fields.r_ssym << 24))
Packit Service 82fcde
#define ELF64_MIPS_R_INFO(sym, type) \
Packit Service 82fcde
  (__extension__ (_Elf64_Mips_R_Info_union) \
Packit Service 82fcde
   (__extension__ (_Elf64_Mips_R_Info) \
Packit Service 82fcde
   { (sym), ELF64_MIPS_R_SSYM (type), \
Packit Service 82fcde
       ELF64_MIPS_R_TYPE3 (type), \
Packit Service 82fcde
       ELF64_MIPS_R_TYPE2 (type), \
Packit Service 82fcde
       ELF64_MIPS_R_TYPE1 (type) \
Packit Service 82fcde
   }).r_info_number)
Packit Service 82fcde
/* These macros decompose the value returned by ELF64_MIPS_R_TYPE, and
Packit Service 82fcde
   compose it back into a value that it can be used as an argument to
Packit Service 82fcde
   ELF64_MIPS_R_INFO.  */
Packit Service 82fcde
#define ELF64_MIPS_R_SSYM(i) (((i) >> 24) & 0xff)
Packit Service 82fcde
#define ELF64_MIPS_R_TYPE3(i) (((i) >> 16) & 0xff)
Packit Service 82fcde
#define ELF64_MIPS_R_TYPE2(i) (((i) >> 8) & 0xff)
Packit Service 82fcde
#define ELF64_MIPS_R_TYPE1(i) ((i) & 0xff)
Packit Service 82fcde
#define ELF64_MIPS_R_TYPEENC(type1, type2, type3, ssym) \
Packit Service 82fcde
  ((type1) \
Packit Service 82fcde
   | ((Elf32_Word)(type2) << 8) \
Packit Service 82fcde
   | ((Elf32_Word)(type3) << 16) \
Packit Service 82fcde
   | ((Elf32_Word)(ssym) << 24))
Packit Service 82fcde
Packit Service 82fcde
#undef ELF64_R_SYM
Packit Service 82fcde
#define ELF64_R_SYM(i) ELF64_MIPS_R_SYM (i)
Packit Service 82fcde
#undef ELF64_R_TYPE
Packit Service 82fcde
#define ELF64_R_TYPE(i) ELF64_MIPS_R_TYPE (i)
Packit Service 82fcde
#undef ELF64_R_INFO
Packit Service 82fcde
#define ELF64_R_INFO(sym, type) ELF64_MIPS_R_INFO ((sym), (type))
Packit Service 82fcde
Packit Service 82fcde
#endif