Back to index

glibc  2.9
ldsodefs.h
Go to the documentation of this file.
00001 /* Run-time dynamic linker data structures for loaded ELF shared objects.
00002    Copyright (C) 2000, 2002, 2003, 2006, 2007 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 #ifndef _MIPS_LDSODEFS_H
00021 #define _MIPS_LDSODEFS_H 1
00022 
00023 #include <elf.h>
00024 
00025 struct La_mips_32_regs;
00026 struct La_mips_32_retval;
00027 struct La_mips_64_regs;
00028 struct La_mips_64_retval;
00029 
00030 #define ARCH_PLTENTER_MEMBERS                                             \
00031     Elf32_Addr (*mips_o32_gnu_pltenter) (Elf32_Sym *, unsigned int,       \
00032                                     uintptr_t *, uintptr_t *,      \
00033                                     const struct La_mips_32_regs *,    \
00034                                     unsigned int *, const char *name,  \
00035                                     long int *framesizep);                \
00036     Elf32_Addr (*mips_n32_gnu_pltenter) (Elf32_Sym *, unsigned int,       \
00037                                     uintptr_t *, uintptr_t *,      \
00038                                     const struct La_mips_64_regs *,    \
00039                                     unsigned int *, const char *name,  \
00040                                     long int *framesizep);                \
00041     Elf64_Addr (*mips_n64_gnu_pltenter) (Elf64_Sym *, unsigned int,       \
00042                                     uintptr_t *, uintptr_t *,      \
00043                                     const struct La_mips_64_regs *,    \
00044                                     unsigned int *, const char *name,  \
00045                                     long int *framesizep);
00046 
00047 #define ARCH_PLTEXIT_MEMBERS                                              \
00048     unsigned int (*mips_o32_gnu_pltexit) (Elf32_Sym *, unsigned int,      \
00049                                      uintptr_t *, uintptr_t *,     \
00050                                      const struct La_mips_32_regs *,   \
00051                                      struct La_mips_32_retval *,          \
00052                                      const char *);                \
00053     unsigned int (*mips_n32_gnu_pltexit) (Elf32_Sym *, unsigned int,      \
00054                                      uintptr_t *, uintptr_t *,     \
00055                                      const struct La_mips_64_regs *,   \
00056                                      struct La_mips_64_retval *,          \
00057                                      const char *);                \
00058     unsigned int (*mips_n64_gnu_pltexit) (Elf64_Sym *, unsigned int,      \
00059                                      uintptr_t *, uintptr_t *,     \
00060                                      const struct La_mips_64_regs *,   \
00061                                      struct La_mips_64_retval *,          \
00062                                      const char *);
00063 
00064 /* The MIPS ABI specifies that the dynamic section has to be read-only.  */
00065 
00066 #define DL_RO_DYN_SECTION 1
00067 
00068 #include_next <ldsodefs.h>
00069 
00070 /* The 64-bit MIPS ELF ABI uses an unusual reloc format.  Each
00071    relocation entry specifies up to three actual relocations, all at
00072    the same address.  The first relocation which required a symbol
00073    uses the symbol in the r_sym field.  The second relocation which
00074    requires a symbol uses the symbol in the r_ssym field.  If all
00075    three relocations require a symbol, the third one uses a zero
00076    value.
00077 
00078    We define these structures in internal headers because we're not
00079    sure we want to make them part of the ABI yet.  Eventually, some of
00080    this may move into elf/elf.h.  */
00081 
00082 /* An entry in a 64 bit SHT_REL section.  */
00083 
00084 typedef struct
00085 {
00086   Elf32_Word    r_sym;             /* Symbol index */
00087   unsigned char r_ssym;            /* Special symbol for 2nd relocation */
00088   unsigned char r_type3;    /* 3rd relocation type */
00089   unsigned char r_type2;    /* 2nd relocation type */
00090   unsigned char r_type1;    /* 1st relocation type */
00091 } _Elf64_Mips_R_Info;
00092 
00093 typedef union
00094 {
00095   Elf64_Xword r_info_number;
00096   _Elf64_Mips_R_Info r_info_fields;
00097 } _Elf64_Mips_R_Info_union;
00098 
00099 typedef struct
00100 {
00101   Elf64_Addr  r_offset;            /* Address */
00102   _Elf64_Mips_R_Info_union r_info; /* Relocation type and symbol index */
00103 } Elf64_Mips_Rel;
00104 
00105 typedef struct
00106 {
00107   Elf64_Addr  r_offset;            /* Address */
00108   _Elf64_Mips_R_Info_union r_info; /* Relocation type and symbol index */
00109   Elf64_Sxword       r_addend;            /* Addend */
00110 } Elf64_Mips_Rela;
00111 
00112 #define ELF64_MIPS_R_SYM(i) \
00113   ((__extension__ (_Elf64_Mips_R_Info_union)(i)).r_info_fields.r_sym)
00114 #define ELF64_MIPS_R_TYPE(i) \
00115   (((_Elf64_Mips_R_Info_union)(i)).r_info_fields.r_type1 \
00116    | ((Elf32_Word)(__extension__ (_Elf64_Mips_R_Info_union)(i) \
00117                  ).r_info_fields.r_type2 << 8) \
00118    | ((Elf32_Word)(__extension__ (_Elf64_Mips_R_Info_union)(i) \
00119                  ).r_info_fields.r_type3 << 16) \
00120    | ((Elf32_Word)(__extension__ (_Elf64_Mips_R_Info_union)(i) \
00121                  ).r_info_fields.r_ssym << 24))
00122 #define ELF64_MIPS_R_INFO(sym, type) \
00123   (__extension__ (_Elf64_Mips_R_Info_union) \
00124    (__extension__ (_Elf64_Mips_R_Info) \
00125    { (sym), ELF64_MIPS_R_SSYM (type), \
00126        ELF64_MIPS_R_TYPE3 (type), \
00127        ELF64_MIPS_R_TYPE2 (type), \
00128        ELF64_MIPS_R_TYPE1 (type) \
00129    }).r_info_number)
00130 /* These macros decompose the value returned by ELF64_MIPS_R_TYPE, and
00131    compose it back into a value that it can be used as an argument to
00132    ELF64_MIPS_R_INFO.  */
00133 #define ELF64_MIPS_R_SSYM(i) (((i) >> 24) & 0xff)
00134 #define ELF64_MIPS_R_TYPE3(i) (((i) >> 16) & 0xff)
00135 #define ELF64_MIPS_R_TYPE2(i) (((i) >> 8) & 0xff)
00136 #define ELF64_MIPS_R_TYPE1(i) ((i) & 0xff)
00137 #define ELF64_MIPS_R_TYPEENC(type1, type2, type3, ssym) \
00138   ((type1) \
00139    | ((Elf32_Word)(type2) << 8) \
00140    | ((Elf32_Word)(type3) << 16) \
00141    | ((Elf32_Word)(ssym) << 24))
00142 
00143 #undef ELF64_R_SYM
00144 #define ELF64_R_SYM(i) ELF64_MIPS_R_SYM (i)
00145 #undef ELF64_R_TYPE
00146 #define ELF64_R_TYPE(i) ELF64_MIPS_R_TYPE (i)
00147 #undef ELF64_R_INFO
00148 #define ELF64_R_INFO(sym, type) ELF64_MIPS_R_INFO ((sym), (type))
00149 
00150 #endif