| 1 | /* ELF32/HPPA relocation support |
| 2 | |
| 3 | This file contains ELF32/HPPA relocation support as specified |
| 4 | in the Stratus FTX/Golf Object File Format (SED-1762) dated |
| 5 | November 19, 1992. |
| 6 | */ |
| 7 | |
| 8 | |
| 9 | /* |
| 10 | Copyright (C) 1990-1991 Free Software Foundation, Inc. |
| 11 | |
| 12 | Written by: |
| 13 | |
| 14 | Center for Software Science |
| 15 | Department of Computer Science |
| 16 | University of Utah |
| 17 | |
| 18 | This file is part of BFD, the Binary File Descriptor library. |
| 19 | |
| 20 | This program is free software; you can redistribute it and/or modify |
| 21 | it under the terms of the GNU General Public License as published by |
| 22 | the Free Software Foundation; either version 2 of the License, or |
| 23 | (at your option) any later version. |
| 24 | |
| 25 | This program is distributed in the hope that it will be useful, |
| 26 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 27 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 28 | GNU General Public License for more details. |
| 29 | |
| 30 | You should have received a copy of the GNU General Public License |
| 31 | along with this program; if not, write to the Free Software |
| 32 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ |
| 33 | |
| 34 | #ifndef _ELF32_HPPA_H |
| 35 | #define _ELF32_HPPA_H |
| 36 | |
| 37 | #include "libelf.h" |
| 38 | |
| 39 | /* 9.3.3. Parameter relocation information */ |
| 40 | |
| 41 | /* As mentioned previously, relocations of calls must be accompanied */ |
| 42 | /* by parameter relocation information, indicating which registers the */ |
| 43 | /* first for parameter words, and the return value, are located in. */ |
| 44 | /* This information accompanies the R_HPPA_ABS_CALL.., */ |
| 45 | /* R_HPPA_PCREL_CALL... and R_HPPA_PUSH_PROC relocation types, */ |
| 46 | /* described below. The information is kept in the high-order 10 bits */ |
| 47 | /* of Elf32_rela.r_addend, while the low-order 22 bits are a signed */ |
| 48 | /* constant to be used in calculating the call target. The following */ |
| 49 | /* macros are used to extract and combine these data in r_addend. */ |
| 50 | |
| 51 | #define ELF32_HPPA_R_ARG_RELOC(a) (((a) >> 22) & 0x3FF) |
| 52 | #define ELF32_HPPA_R_CONSTANT(a) ((((Elf32_Sword)(a)) << 10) >> 10) |
| 53 | #define ELF32_HPPA_R_ADDEND(r,c) (((r) << 22) + ((c) & 0x3FFFFF)) |
| 54 | |
| 55 | /* ELF/HPPA relocation types */ |
| 56 | |
| 57 | /* name expression format */ |
| 58 | /* -------------------------------------------------------------- */ |
| 59 | typedef enum |
| 60 | { |
| 61 | /* 9.3.4. Address relocation types */ |
| 62 | |
| 63 | /* These relocation types do simple base+offset relocations, and are */ |
| 64 | /* normally used for absolute references to data. */ |
| 65 | |
| 66 | /* By convention, relocation type zero is always "no relocation", */ |
| 67 | /* while type one is 32-bit word relocation. */ |
| 68 | |
| 69 | R_HPPA_NONE, /* - - */ |
| 70 | |
| 71 | R_HPPA_32, /* Symbol + Addend 32 */ |
| 72 | R_HPPA_11, /* Symbol + Addend 11 */ |
| 73 | R_HPPA_14, /* Symbol + Addend 11 */ |
| 74 | R_HPPA_17, /* Symbol + Addend 11 */ |
| 75 | R_HPPA_L21, /* L (Symbol, Addend) 21 */ |
| 76 | R_HPPA_R11, /* R (Symbol, Addend) 11 */ |
| 77 | R_HPPA_R14, /* R (Symbol, Addend) 14 */ |
| 78 | R_HPPA_R17, /* R (Symbol, Addend) 17 */ |
| 79 | R_HPPA_LS21, /* LS(Symbol, Addend) 21 */ |
| 80 | R_HPPA_RS11, /* RS(Symbol, Addend) 11 */ |
| 81 | R_HPPA_RS14, /* RS(Symbol, Addend) 14 */ |
| 82 | R_HPPA_RS17, /* RS(Symbol, Addend) 17 */ |
| 83 | R_HPPA_LD21, /* LD(Symbol, Addend) 21 */ |
| 84 | R_HPPA_RD11, /* RD(Symbol, Addend) 11 */ |
| 85 | R_HPPA_RD14, /* RD(Symbol, Addend) 14 */ |
| 86 | R_HPPA_RD17, /* RD(Symbol, Addend) 17 */ |
| 87 | R_HPPA_LR21, /* LR(Symbol, Addend) 21 */ |
| 88 | R_HPPA_RR14, /* RR(Symbol, Addend) 14 */ |
| 89 | R_HPPA_RR17, /* RR(Symbol, Addend) 17 */ |
| 90 | |
| 91 | /* 9.3.5. GOTOFF address relocation types */ |
| 92 | |
| 93 | /* The Global Offset Table (GOT) is a table of pointers to data, but */ |
| 94 | /* its address can also be used as a base pointer to address data, */ |
| 95 | /* similar to the way the DP is used in HP/UX. The expression */ |
| 96 | /* calculation yields a signed offset of an address from the GOT. */ |
| 97 | |
| 98 | R_HPPA_GOTOFF_11, /* Symbol - GOT + Addend 11 */ |
| 99 | R_HPPA_GOTOFF_14, /* Symbol - GOT + Addend 14 */ |
| 100 | R_HPPA_GOTOFF_L21, /* L (Sym - GOT, Addend) 21 */ |
| 101 | R_HPPA_GOTOFF_R11, /* R (Sym - GOT, Addend) 11 */ |
| 102 | R_HPPA_GOTOFF_R14, /* R (Sym - GOT, Addend) 14 */ |
| 103 | R_HPPA_GOTOFF_LS21, /* LS(Sym - GOT, Addend) 21 */ |
| 104 | R_HPPA_GOTOFF_RS11, /* RS(Sym - GOT, Addend) 11 */ |
| 105 | R_HPPA_GOTOFF_RS14, /* RS(Sym - GOT, Addend) 14 */ |
| 106 | R_HPPA_GOTOFF_LD21, /* LD(Sym - GOT, Addend) 21 */ |
| 107 | R_HPPA_GOTOFF_RD11, /* RD(Sym - GOT, Addend) 11 */ |
| 108 | R_HPPA_GOTOFF_RD14, /* RD(Sym - GOT, Addend) 14 */ |
| 109 | R_HPPA_GOTOFF_LR21, /* LR(Sym - GOT, Addend) 21 */ |
| 110 | R_HPPA_GOTOFF_RR14, /* RR(Sym - GOT, Addend) 14 */ |
| 111 | |
| 112 | /* 9.3.6. Absolute call relocation types */ |
| 113 | |
| 114 | /* Relocations of function calls must be accompanied by parameter */ |
| 115 | /* relocation information. This information is carried in the ten */ |
| 116 | /* high-order bits of the addend field. The remaining 22 bits of */ |
| 117 | /* of the addend field are sign-extended to form the Addend. */ |
| 118 | |
| 119 | R_HPPA_ABS_CALL_11, /* Symbol + Addend 11 */ |
| 120 | R_HPPA_ABS_CALL_14, /* Symbol + Addend 14 */ |
| 121 | R_HPPA_ABS_CALL_17, /* Symbol + Addend 17 */ |
| 122 | R_HPPA_ABS_CALL_L21, /* L (Symbol, Addend) 21 */ |
| 123 | R_HPPA_ABS_CALL_R11, /* R (Symbol, Addend) 11 */ |
| 124 | R_HPPA_ABS_CALL_R14, /* R (Symbol, Addend) 14 */ |
| 125 | R_HPPA_ABS_CALL_R17, /* R (Symbol, Addend) 17 */ |
| 126 | R_HPPA_ABS_CALL_LS21, /* LS(Symbol, Addend) 21 */ |
| 127 | R_HPPA_ABS_CALL_RS11, /* RS(Symbol, Addend) 11 */ |
| 128 | R_HPPA_ABS_CALL_RS14, /* RS(Symbol, Addend) 14 */ |
| 129 | R_HPPA_ABS_CALL_RS17, /* RS(Symbol, Addend) 17 */ |
| 130 | R_HPPA_ABS_CALL_LD21, /* LD(Symbol, Addend) 21 */ |
| 131 | R_HPPA_ABS_CALL_RD11, /* RD(Symbol, Addend) 11 */ |
| 132 | R_HPPA_ABS_CALL_RD14, /* RD(Symbol, Addend) 14 */ |
| 133 | R_HPPA_ABS_CALL_RD17, /* RD(Symbol, Addend) 17 */ |
| 134 | R_HPPA_ABS_CALL_LR21, /* LR(Symbol, Addend) 21 */ |
| 135 | R_HPPA_ABS_CALL_RR14, /* RR(Symbol, Addend) 14 */ |
| 136 | R_HPPA_ABS_CALL_RR17, /* RR(Symbol, Addend) 17 */ |
| 137 | |
| 138 | /* 9.3.7. PC-relative call relocation types */ |
| 139 | |
| 140 | /* PC-relative relocation calculates the difference between an address */ |
| 141 | /* and the location being relocated. This is most often used to */ |
| 142 | /* relocate pc-relative calls. */ |
| 143 | |
| 144 | /* As with the ABS_CALL relocation types, the ten high-order bits of */ |
| 145 | /* the addend field carry parameter relocation information, while */ |
| 146 | /* the low-order 22 bits are sign-extended to form the Addend. */ |
| 147 | |
| 148 | R_HPPA_PCREL_CALL_11, /* Symbol - PC + Addend 11 */ |
| 149 | R_HPPA_PCREL_CALL_14, /* Symbol - PC + Addend 14 */ |
| 150 | R_HPPA_PCREL_CALL_17, /* Symbol - PC + Addend 17 */ |
| 151 | R_HPPA_PCREL_CALL_12, /* Symbol - PC + Addend 12 */ |
| 152 | R_HPPA_PCREL_CALL_L21, /* L (Symbol - PC, Addend) 21 */ |
| 153 | R_HPPA_PCREL_CALL_R11, /* R (Symbol - PC, Addend) 11 */ |
| 154 | R_HPPA_PCREL_CALL_R14, /* R (Symbol - PC, Addend) 14 */ |
| 155 | R_HPPA_PCREL_CALL_R17, /* R (Symbol - PC, Addend) 17 */ |
| 156 | R_HPPA_PCREL_CALL_LS21, /* LS(Symbol - PC, Addend) 21 */ |
| 157 | R_HPPA_PCREL_CALL_RS11, /* RS(Symbol - PC, Addend) 11 */ |
| 158 | R_HPPA_PCREL_CALL_RS14, /* RS(Symbol - PC, Addend) 14 */ |
| 159 | R_HPPA_PCREL_CALL_RS17, /* RS(Symbol - PC, Addend) 17 */ |
| 160 | R_HPPA_PCREL_CALL_LD21, /* LD(Symbol - PC, Addend) 21 */ |
| 161 | R_HPPA_PCREL_CALL_RD11, /* RD(Symbol - PC, Addend) 11 */ |
| 162 | R_HPPA_PCREL_CALL_RD14, /* RD(Symbol - PC, Addend) 14 */ |
| 163 | R_HPPA_PCREL_CALL_RD17, /* RD(Symbol - PC, Addend) 17 */ |
| 164 | R_HPPA_PCREL_CALL_LR21, /* LR(Symbol - PC, Addend) 21 */ |
| 165 | R_HPPA_PCREL_CALL_RR14, /* RR(Symbol - PC, Addend) 14 */ |
| 166 | R_HPPA_PCREL_CALL_RR17, /* RR(Symbol - PC, Addend) 17 *//* #69 */ |
| 167 | |
| 168 | /* 9.3.8. Plabel relocation types */ |
| 169 | |
| 170 | /* Plabels are designed to allow code pointers to be passed between */ |
| 171 | /* spaces. The addend of the relocation should be either 0 (no static */ |
| 172 | /* link) or 2 (static link required). These relocations correspond to */ |
| 173 | /* the P%, LP% and RP% field selectors. [Description is incomplete] */ |
| 174 | |
| 175 | R_HPPA_PLABEL_32, /* F(Plabel(Symbol,Addend),0) 32 */ |
| 176 | R_HPPA_PLABEL_11, /* F(Plabel(Symbol,Addend),0) 11 */ |
| 177 | R_HPPA_PLABEL_14, /* F(Plabel(Symbol,Addend),0) 14 */ |
| 178 | R_HPPA_PLABEL_L21, /* L(Plabel(Symbol,Addend),0) 21 */ |
| 179 | R_HPPA_PLABEL_R11, /* R(Plabel(Symbol,Addend),0) 11 */ |
| 180 | R_HPPA_PLABEL_R14, /* R(Plabel(Symbol,Addend),0) 14 */ |
| 181 | |
| 182 | /* 9.3.9. Data linkage table (DLT) relocation types */ |
| 183 | |
| 184 | /* SOM DLT_REL fixup requests are used to for static data references */ |
| 185 | /* from position-independent code within shared libraries. They are */ |
| 186 | /* similar to the GOT relocation types in some SVR4 implementations. */ |
| 187 | /* [Prose to come] */ |
| 188 | |
| 189 | R_HPPA_DLT_32, /* F(DLTOFF) 32 */ |
| 190 | R_HPPA_DLT_11, /* F(DLTOFF) 11 */ |
| 191 | R_HPPA_DLT_14, /* F(DLTOFF) 14 */ |
| 192 | R_HPPA_DLT_L21, /* L(DLTOFF) 21 */ |
| 193 | R_HPPA_DLT_R11, /* R(DLTOFF) 11 */ |
| 194 | R_HPPA_DLT_R14, /* R(DLTOFF) 14 */ |
| 195 | |
| 196 | /* 9.3.10. Relocations for unwinder tables */ |
| 197 | |
| 198 | /* As described above, the unwinder table consists of a series of */ |
| 199 | /* four-word entries, the first two of which are a pair of code */ |
| 200 | /* addresses. While it would be possible to relocate this table using */ |
| 201 | /* just R_HPPA_32, the amount of relocation data resulting would be */ |
| 202 | /* very large. To reduce that data, the following relocation types */ |
| 203 | /* have been defined. */ |
| 204 | |
| 205 | /* The first, R_HPPA_UNWIND_ENTRY, merely compresses two R_HPPA_32 */ |
| 206 | /* operations into one. It is designed for use in .rel-type */ |
| 207 | /* relocations, where the two 32-bit addends are taken from the unwind */ |
| 208 | /* section itself. */ |
| 209 | |
| 210 | /* The second, which is designed for use in .rela-type relocations, is */ |
| 211 | /* designed to relocate an entire unwinder table with one relocation */ |
| 212 | /* entry. It has the effect of multiple R_HPPA_UNWIND_ENTRY */ |
| 213 | /* relocations applied to successive unwinder table entries. The */ |
| 214 | /* number of entries to be relocated is given in the r_addend field of */ |
| 215 | /* the relocation entry. The rest of the relocation entry is used in */ |
| 216 | /* a normal way--r_offset is the offset of the first unwind entry in */ |
| 217 | /* the section, while ELF32_R_SYM(r_info) is the code section that all */ |
| 218 | /* the code addresses should be relocated from. */ |
| 219 | |
| 220 | R_HPPA_UNWIND_ENTRY, /* "128" */ |
| 221 | R_HPPA_UNWIND_ENTRIES, /* Addend * "128" */ |
| 222 | |
| 223 | /* 9.3.11. Relocation types for complex expressions */ |
| 224 | |
| 225 | /* As described above, new-format SOM fixups support complex */ |
| 226 | /* expressions by spreading the parts of the expression across */ |
| 227 | /* multiple entries. ELF for HPPA will have a similar mechanism, */ |
| 228 | /* although support for it may be optional. There are two main */ |
| 229 | /* reasons for defining it: first, the need to translate complex */ |
| 230 | /* SOM fixup expressions to ELF, and second, to cover combinations */ |
| 231 | /* of expression, field and format not available with other */ |
| 232 | /* relocation types. */ |
| 233 | |
| 234 | /* ELF expression relocation entries are interpreted as postfix-form */ |
| 235 | /* expressions. They may be evaluated using a push-down stack. */ |
| 236 | |
| 237 | /* Usually, the addend field of these expression relocation entries is */ |
| 238 | /* unused, with the following exceptions: */ |
| 239 | |
| 240 | /* R_HPPA_PUSH_CONST: The addend field contains the constant. */ |
| 241 | |
| 242 | /* R_HPPA_PUSH_PROC: The high-order 10 bits of the addend field */ |
| 243 | /* contain parameter relocation information. The rest of */ |
| 244 | /* the addend field is unused. */ |
| 245 | |
| 246 | /* R_HPPA_LSHIFT, R_HPPA_ARITH_RSHIFT and R_HPPA_LOGIC_RSHIFT: */ |
| 247 | /* The addend field normally gives the amount to shift. */ |
| 248 | /* However, if that amount is zero, the shift amount is */ |
| 249 | /* popped from the top of the stack prior to popping the */ |
| 250 | /* amount to be shifted. */ |
| 251 | |
| 252 | /* name expression fld/fmt */ |
| 253 | /* ------------------------------------------------------------------- */ |
| 254 | R_HPPA_PUSH_CONST, /* push Addend - - */ |
| 255 | R_HPPA_PUSH_PC, /* push PC + Addend - - */ |
| 256 | R_HPPA_PUSH_SYM, /* push Symbol + Addend - - */ |
| 257 | R_HPPA_PUSH_GOTOFF, /* push Symbol - GOT + Addend - - */ |
| 258 | R_HPPA_PUSH_ABS_CALL, /* push Symbol + Addend - - */ |
| 259 | R_HPPA_PUSH_PCREL_CALL, /* push Symbol - PC + Addend - - */ |
| 260 | R_HPPA_PUSH_PLABEL, /* push Plabel(Symbol) - - */ |
| 261 | R_HPPA_MAX, /* pop A and B, push max(B,A) - - */ |
| 262 | R_HPPA_MIN, /* pop A and B, push min(B,A) - - */ |
| 263 | R_HPPA_ADD, /* pop A and B, push B + A - - */ |
| 264 | R_HPPA_SUB, /* pop A and B, push B - A - - */ |
| 265 | R_HPPA_MULT, /* pop A and B, push B * A - - */ |
| 266 | R_HPPA_DIV, /* pop A and B, push B / A - - */ |
| 267 | R_HPPA_MOD, /* pop A and B, push B % A - - */ |
| 268 | R_HPPA_AND, /* pop A and B, push B & A - - */ |
| 269 | R_HPPA_OR, /* pop A and B, push B | A - - */ |
| 270 | R_HPPA_XOR, /* pop A and B, push B ^ A - - */ |
| 271 | R_HPPA_NOT, /* pop A, push ~A - - */ |
| 272 | R_HPPA_LSHIFT, /* pop A, push A << Addend - - */ |
| 273 | R_HPPA_ARITH_RSHIFT, /* pop A, push A >> Addend - - */ |
| 274 | R_HPPA_LOGIC_RSHIFT, /* pop A, push A >> Addend - - */ |
| 275 | R_HPPA_EXPR_F, /* pop A, push A + Addend F - */ |
| 276 | R_HPPA_EXPR_L, /* pop A, push L(A,Addend) L - */ |
| 277 | R_HPPA_EXPR_R, /* pop A, push R(A,Addend) R - */ |
| 278 | R_HPPA_EXPR_LS, /* pop A, push LS(A,Addend) LS - */ |
| 279 | R_HPPA_EXPR_RS, /* pop A, push RS(A,Addend) RS - */ |
| 280 | R_HPPA_EXPR_LD, /* pop A, push LD(A,Addend) LD - */ |
| 281 | R_HPPA_EXPR_RD, /* pop A, push RD(A,Addend) RD - */ |
| 282 | R_HPPA_EXPR_LR, /* pop A, push LR(A,Addend) LR - */ |
| 283 | R_HPPA_EXPR_RR, /* pop A, push RR(A,Addend) RR - */ |
| 284 | |
| 285 | R_HPPA_EXPR_32, /* pop - 32 */ |
| 286 | R_HPPA_EXPR_21, /* pop - 21 */ |
| 287 | R_HPPA_EXPR_11, /* pop - 11 */ |
| 288 | R_HPPA_EXPR_14, /* pop - 14 */ |
| 289 | R_HPPA_EXPR_17, /* pop - 17 */ |
| 290 | R_HPPA_EXPR_12, /* pop - 12 */ |
| 291 | R_HPPA_STUB_CALL_17, /* Symbol + Addend 17 */ |
| 292 | R_HPPA_UNIMPLEMENTED /* N/A */ |
| 293 | } elf32_hppa_reloc_type; |
| 294 | |
| 295 | #define ELF_HOWTO_TABLE_SIZE R_HPPA_UNIMPLEMENTED + 1 |
| 296 | #define N_HPPA_RELOCS R_HPPA_UNIMPLEMENTED + 1 |
| 297 | |
| 298 | /* Groups of relocations. Serves as an expression type. */ |
| 299 | |
| 300 | #define R_HPPA R_HPPA_32 |
| 301 | #define R_HPPA_GOTOFF R_HPPA_GOTOFF_11 |
| 302 | #define R_HPPA_ABS_CALL R_HPPA_ABS_CALL_11 |
| 303 | #define R_HPPA_PCREL_CALL R_HPPA_PCREL_CALL_11 |
| 304 | #define R_HPPA_PLABEL R_HPPA_PLABEL_32 |
| 305 | #define R_HPPA_DLT R_HPPA_DLT_32 |
| 306 | #define R_HPPA_UNWIND R_HPPA_UNWIND_ENTRY |
| 307 | #define R_HPPA_COMPLEX R_HPPA_PUSH_CONST |
| 308 | #define R_HPPA_COMPLEX_PCREL_CALL R_HPPA_PUSH_CONST + 1 |
| 309 | #define R_HPPA_COMPLEX_ABS_CALL R_HPPA_PUSH_CONST + 2 |
| 310 | |
| 311 | |
| 312 | /* PA-RISC OPCODES */ |
| 313 | |
| 314 | #define get_opcode(insn) ((insn) & 0xfc000000) >> 26 |
| 315 | |
| 316 | /* XXX: this list is incomplete */ |
| 317 | |
| 318 | #define LDO 0x0d |
| 319 | #define LDB 0x10 |
| 320 | #define LDH 0x11 |
| 321 | #define LDW 0x12 |
| 322 | #define LDWM 0x13 |
| 323 | #define STB 0x18 |
| 324 | #define STH 0x19 |
| 325 | #define STW 0x1a |
| 326 | #define STWM 0x1b |
| 327 | #define COMICLR 0x24 |
| 328 | #define SUBI 0x25 |
| 329 | #define SUBIO 0x25 |
| 330 | #define ADDIT 0x2c |
| 331 | #define ADDITO 0x2c |
| 332 | #define ADDI 0x2d |
| 333 | #define ADDIO 0x2d |
| 334 | #define LDIL 0x08 |
| 335 | #define ADDIL 0x0a |
| 336 | |
| 337 | #define MOVB 0x32 |
| 338 | #define MOVIB 0x33 |
| 339 | #define COMBT 0x20 |
| 340 | #define COMBF 0x22 |
| 341 | #define COMIBT 0x21 |
| 342 | #define COMIBF 0x23 |
| 343 | #define ADDBT 0x28 |
| 344 | #define ADDBF 0x2a |
| 345 | #define ADDIBT 0x29 |
| 346 | #define ADDIBF 0x2b |
| 347 | #define BVB 0x30 |
| 348 | #define BB 0x31 |
| 349 | |
| 350 | #define BL 0x3a |
| 351 | #define BLE 0x39 |
| 352 | #define BE 0x38 |
| 353 | |
| 354 | #ifdef __STDC__ |
| 355 | elf32_hppa_reloc_type **hppa_elf_gen_reloc_type (bfd * abfd, elf32_hppa_reloc_type base_type, int format, int field); |
| 356 | #else |
| 357 | elf32_hppa_reloc_type **hppa_elf_gen_reloc_type (); |
| 358 | #endif |
| 359 | |
| 360 | /* |
| 361 | * HPPA Section types |
| 362 | */ |
| 363 | |
| 364 | #define SHT_HPPA_SYMEXTN SHT_LOPROC |
| 365 | |
| 366 | |
| 367 | /* |
| 368 | * HPPA Symbol types |
| 369 | */ |
| 370 | |
| 371 | #define STT_HPPA_PLABEL STT_LOPROC |
| 372 | |
| 373 | |
| 374 | /* |
| 375 | * HPPA symbol table extension entry types |
| 376 | */ |
| 377 | |
| 378 | #define HPPA_SXT_NULL 0x00 |
| 379 | #define HPPA_SXT_SYMNDX 0x01 |
| 380 | #define HPPA_SXT_ARG_RELOC 0x02 |
| 381 | |
| 382 | /* |
| 383 | * These macros compose and decompose the value of a symextn entry: |
| 384 | * |
| 385 | * entry_type = ELF32_HPPA_SX_TYPE(word); |
| 386 | * entry_value = ELF32_HPPA_SX_VAL(word); |
| 387 | * word = ELF32_HPPA_SX_WORD(type,val); |
| 388 | * Se.hppa_se_info = ELF32_HPPA_SE_INFO(arg_reloc) |
| 389 | */ |
| 390 | |
| 391 | #define ELF32_HPPA_SX_TYPE(p) ((p) >> 24) |
| 392 | #define ELF32_HPPA_SX_VAL(p) ((p) & 0xFFFFFF) |
| 393 | #define ELF32_HPPA_SX_WORD(type,val) (((type) << 24) + (val & 0xFFFFFF)) |
| 394 | |
| 395 | /* The following was added facilitate implementation of the .hppa_symextn |
| 396 | section. This section is built after the symbol table is built in the |
| 397 | elf_write_object_contents routine (called from bfd_close). It is built |
| 398 | so late because it requires information that is not known until |
| 399 | the symbol and string table sections have been allocated, and |
| 400 | the symbol table has been built. */ |
| 401 | |
| 402 | #define ELF_TC_FAKE_SECTIONS 1 /* # of "hand_made" tc-specific sections */ |
| 403 | #define SYMEXTN_SECTION_NAME ".hppa_symextn" |
| 404 | |
| 405 | extern void elf_hppa_tc_symbol PARAMS ((bfd *, elf32_symbol_type *, int)); |
| 406 | extern void elf_hppa_tc_make_sections PARAMS ((bfd *, PTR)); |
| 407 | |
| 408 | typedef Elf32_Word symext_entryS; |
| 409 | |
| 410 | struct symext_chain |
| 411 | { |
| 412 | symext_entryS entry; |
| 413 | struct symext_chain *next; |
| 414 | }; |
| 415 | |
| 416 | typedef struct symext_chain symext_chainS; |
| 417 | |
| 418 | #endif /* _ELF32_HPPA_H */ |