Remove .cvsignore files
[glibc-ports.git] / sysdeps / mips / ldsodefs.h
blob5f85eef6e430ac6fb44535c7170bbedcf3f3cb52
1 /* Run-time dynamic linker data structures for loaded ELF shared objects.
2 Copyright (C) 2000, 2002, 2003, 2006, 2007 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
20 #ifndef _MIPS_LDSODEFS_H
21 #define _MIPS_LDSODEFS_H 1
23 #include <elf.h>
25 struct La_mips_32_regs;
26 struct La_mips_32_retval;
27 struct La_mips_64_regs;
28 struct La_mips_64_retval;
30 #define ARCH_PLTENTER_MEMBERS \
31 Elf32_Addr (*mips_o32_gnu_pltenter) (Elf32_Sym *, unsigned int, \
32 uintptr_t *, uintptr_t *, \
33 const struct La_mips_32_regs *, \
34 unsigned int *, const char *name, \
35 long int *framesizep); \
36 Elf32_Addr (*mips_n32_gnu_pltenter) (Elf32_Sym *, unsigned int, \
37 uintptr_t *, uintptr_t *, \
38 const struct La_mips_64_regs *, \
39 unsigned int *, const char *name, \
40 long int *framesizep); \
41 Elf64_Addr (*mips_n64_gnu_pltenter) (Elf64_Sym *, unsigned int, \
42 uintptr_t *, uintptr_t *, \
43 const struct La_mips_64_regs *, \
44 unsigned int *, const char *name, \
45 long int *framesizep);
47 #define ARCH_PLTEXIT_MEMBERS \
48 unsigned int (*mips_o32_gnu_pltexit) (Elf32_Sym *, unsigned int, \
49 uintptr_t *, uintptr_t *, \
50 const struct La_mips_32_regs *, \
51 struct La_mips_32_retval *, \
52 const char *); \
53 unsigned int (*mips_n32_gnu_pltexit) (Elf32_Sym *, unsigned int, \
54 uintptr_t *, uintptr_t *, \
55 const struct La_mips_64_regs *, \
56 struct La_mips_64_retval *, \
57 const char *); \
58 unsigned int (*mips_n64_gnu_pltexit) (Elf64_Sym *, unsigned int, \
59 uintptr_t *, uintptr_t *, \
60 const struct La_mips_64_regs *, \
61 struct La_mips_64_retval *, \
62 const char *);
64 /* The MIPS ABI specifies that the dynamic section has to be read-only. */
66 #define DL_RO_DYN_SECTION 1
68 #include_next <ldsodefs.h>
70 /* The 64-bit MIPS ELF ABI uses an unusual reloc format. Each
71 relocation entry specifies up to three actual relocations, all at
72 the same address. The first relocation which required a symbol
73 uses the symbol in the r_sym field. The second relocation which
74 requires a symbol uses the symbol in the r_ssym field. If all
75 three relocations require a symbol, the third one uses a zero
76 value.
78 We define these structures in internal headers because we're not
79 sure we want to make them part of the ABI yet. Eventually, some of
80 this may move into elf/elf.h. */
82 /* An entry in a 64 bit SHT_REL section. */
84 typedef struct
86 Elf32_Word r_sym; /* Symbol index */
87 unsigned char r_ssym; /* Special symbol for 2nd relocation */
88 unsigned char r_type3; /* 3rd relocation type */
89 unsigned char r_type2; /* 2nd relocation type */
90 unsigned char r_type1; /* 1st relocation type */
91 } _Elf64_Mips_R_Info;
93 typedef union
95 Elf64_Xword r_info_number;
96 _Elf64_Mips_R_Info r_info_fields;
97 } _Elf64_Mips_R_Info_union;
99 typedef struct
101 Elf64_Addr r_offset; /* Address */
102 _Elf64_Mips_R_Info_union r_info; /* Relocation type and symbol index */
103 } Elf64_Mips_Rel;
105 typedef struct
107 Elf64_Addr r_offset; /* Address */
108 _Elf64_Mips_R_Info_union r_info; /* Relocation type and symbol index */
109 Elf64_Sxword r_addend; /* Addend */
110 } Elf64_Mips_Rela;
112 #define ELF64_MIPS_R_SYM(i) \
113 ((__extension__ (_Elf64_Mips_R_Info_union)(i)).r_info_fields.r_sym)
114 #define ELF64_MIPS_R_TYPE(i) \
115 (((_Elf64_Mips_R_Info_union)(i)).r_info_fields.r_type1 \
116 | ((Elf32_Word)(__extension__ (_Elf64_Mips_R_Info_union)(i) \
117 ).r_info_fields.r_type2 << 8) \
118 | ((Elf32_Word)(__extension__ (_Elf64_Mips_R_Info_union)(i) \
119 ).r_info_fields.r_type3 << 16) \
120 | ((Elf32_Word)(__extension__ (_Elf64_Mips_R_Info_union)(i) \
121 ).r_info_fields.r_ssym << 24))
122 #define ELF64_MIPS_R_INFO(sym, type) \
123 (__extension__ (_Elf64_Mips_R_Info_union) \
124 (__extension__ (_Elf64_Mips_R_Info) \
125 { (sym), ELF64_MIPS_R_SSYM (type), \
126 ELF64_MIPS_R_TYPE3 (type), \
127 ELF64_MIPS_R_TYPE2 (type), \
128 ELF64_MIPS_R_TYPE1 (type) \
129 }).r_info_number)
130 /* These macros decompose the value returned by ELF64_MIPS_R_TYPE, and
131 compose it back into a value that it can be used as an argument to
132 ELF64_MIPS_R_INFO. */
133 #define ELF64_MIPS_R_SSYM(i) (((i) >> 24) & 0xff)
134 #define ELF64_MIPS_R_TYPE3(i) (((i) >> 16) & 0xff)
135 #define ELF64_MIPS_R_TYPE2(i) (((i) >> 8) & 0xff)
136 #define ELF64_MIPS_R_TYPE1(i) ((i) & 0xff)
137 #define ELF64_MIPS_R_TYPEENC(type1, type2, type3, ssym) \
138 ((type1) \
139 | ((Elf32_Word)(type2) << 8) \
140 | ((Elf32_Word)(type3) << 16) \
141 | ((Elf32_Word)(ssym) << 24))
143 #undef ELF64_R_SYM
144 #define ELF64_R_SYM(i) ELF64_MIPS_R_SYM (i)
145 #undef ELF64_R_TYPE
146 #define ELF64_R_TYPE(i) ELF64_MIPS_R_TYPE (i)
147 #undef ELF64_R_INFO
148 #define ELF64_R_INFO(sym, type) ELF64_MIPS_R_INFO ((sym), (type))
150 #endif