Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | Upstream-Status: Backport |
| 2 | |
| 3 | Index: elfutils-0.146/backends/parisc_init.c |
| 4 | =================================================================== |
| 5 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 6 | +++ elfutils-0.146/backends/parisc_init.c 2010-04-24 10:10:50.000000000 +0000 |
| 7 | @@ -0,0 +1,74 @@ |
| 8 | +/* Initialization of PA-RISC specific backend library. |
| 9 | + Copyright (C) 2002, 2005, 2006 Red Hat, Inc. |
| 10 | + This file is part of Red Hat elfutils. |
| 11 | + Written by Ulrich Drepper <drepper@redhat.com>, 2002. |
| 12 | + |
| 13 | + Red Hat elfutils is free software; you can redistribute it and/or modify |
| 14 | + it under the terms of the GNU General Public License as published by the |
| 15 | + Free Software Foundation; version 2 of the License. |
| 16 | + |
| 17 | + Red Hat elfutils is distributed in the hope that it will be useful, but |
| 18 | + WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 20 | + General Public License for more details. |
| 21 | + |
| 22 | + You should have received a copy of the GNU General Public License along |
| 23 | + with Red Hat elfutils; if not, write to the Free Software Foundation, |
| 24 | + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. |
| 25 | + |
| 26 | + Red Hat elfutils is an included package of the Open Invention Network. |
| 27 | + An included package of the Open Invention Network is a package for which |
| 28 | + Open Invention Network licensees cross-license their patents. No patent |
| 29 | + license is granted, either expressly or impliedly, by designation as an |
| 30 | + included package. Should you wish to participate in the Open Invention |
| 31 | + Network licensing program, please visit www.openinventionnetwork.com |
| 32 | + <http://www.openinventionnetwork.com>. */ |
| 33 | + |
| 34 | +#ifdef HAVE_CONFIG_H |
| 35 | +# include <config.h> |
| 36 | +#endif |
| 37 | + |
| 38 | +#define BACKEND parisc_ |
| 39 | +#define RELOC_PREFIX R_PARISC_ |
| 40 | +#include "libebl_CPU.h" |
| 41 | +#include "libebl_parisc.h" |
| 42 | + |
| 43 | +/* This defines the common reloc hooks based on parisc_reloc.def. */ |
| 44 | +#include "common-reloc.c" |
| 45 | + |
| 46 | + |
| 47 | +const char * |
| 48 | +parisc_init (elf, machine, eh, ehlen) |
| 49 | + Elf *elf __attribute__ ((unused)); |
| 50 | + GElf_Half machine __attribute__ ((unused)); |
| 51 | + Ebl *eh; |
| 52 | + size_t ehlen; |
| 53 | +{ |
| 54 | + int pa64 = 0; |
| 55 | + |
| 56 | + /* Check whether the Elf_BH object has a sufficent size. */ |
| 57 | + if (ehlen < sizeof (Ebl)) |
| 58 | + return NULL; |
| 59 | + |
| 60 | + if (elf) { |
| 61 | + GElf_Ehdr ehdr_mem; |
| 62 | + GElf_Ehdr *ehdr = gelf_getehdr (elf, &ehdr_mem); |
| 63 | + if (ehdr && (ehdr->e_flags & EF_PARISC_WIDE)) |
| 64 | + pa64 = 1; |
| 65 | + } |
| 66 | + /* We handle it. */ |
| 67 | + eh->name = "PA-RISC"; |
| 68 | + parisc_init_reloc (eh); |
| 69 | + HOOK (eh, reloc_simple_type); |
| 70 | + HOOK (eh, machine_flag_check); |
| 71 | + HOOK (eh, symbol_type_name); |
| 72 | + HOOK (eh, segment_type_name); |
| 73 | + HOOK (eh, section_type_name); |
| 74 | + HOOK (eh, register_info); |
| 75 | + if (pa64) |
| 76 | + eh->return_value_location = parisc_return_value_location_64; |
| 77 | + else |
| 78 | + eh->return_value_location = parisc_return_value_location_32; |
| 79 | + |
| 80 | + return MODVERSION; |
| 81 | +} |
| 82 | Index: elfutils-0.146/backends/parisc_regs.c |
| 83 | =================================================================== |
| 84 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 85 | +++ elfutils-0.146/backends/parisc_regs.c 2010-04-24 10:10:50.000000000 +0000 |
| 86 | @@ -0,0 +1,159 @@ |
| 87 | +/* Register names and numbers for PA-RISC DWARF. |
| 88 | + Copyright (C) 2005, 2006 Red Hat, Inc. |
| 89 | + This file is part of Red Hat elfutils. |
| 90 | + |
| 91 | + Red Hat elfutils is free software; you can redistribute it and/or modify |
| 92 | + it under the terms of the GNU General Public License as published by the |
| 93 | + Free Software Foundation; version 2 of the License. |
| 94 | + |
| 95 | + Red Hat elfutils is distributed in the hope that it will be useful, but |
| 96 | + WITHOUT ANY WARRANTY; without even the implied warranty of |
| 97 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 98 | + General Public License for more details. |
| 99 | + |
| 100 | + You should have received a copy of the GNU General Public License along |
| 101 | + with Red Hat elfutils; if not, write to the Free Software Foundation, |
| 102 | + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. |
| 103 | + |
| 104 | + Red Hat elfutils is an included package of the Open Invention Network. |
| 105 | + An included package of the Open Invention Network is a package for which |
| 106 | + Open Invention Network licensees cross-license their patents. No patent |
| 107 | + license is granted, either expressly or impliedly, by designation as an |
| 108 | + included package. Should you wish to participate in the Open Invention |
| 109 | + Network licensing program, please visit www.openinventionnetwork.com |
| 110 | + <http://www.openinventionnetwork.com>. */ |
| 111 | + |
| 112 | +#ifdef HAVE_CONFIG_H |
| 113 | +# include <config.h> |
| 114 | +#endif |
| 115 | + |
| 116 | +#include <string.h> |
| 117 | +#include <dwarf.h> |
| 118 | + |
| 119 | +#define BACKEND parisc_ |
| 120 | +#include "libebl_CPU.h" |
| 121 | + |
| 122 | +ssize_t |
| 123 | +parisc_register_info (Ebl *ebl, int regno, char *name, size_t namelen, |
| 124 | + const char **prefix, const char **setname, |
| 125 | + int *bits, int *type) |
| 126 | +{ |
| 127 | + int pa64 = 0; |
| 128 | + |
| 129 | + if (ebl->elf) { |
| 130 | + GElf_Ehdr ehdr_mem; |
| 131 | + GElf_Ehdr *ehdr = gelf_getehdr (ebl->elf, &ehdr_mem); |
| 132 | + if (ehdr->e_flags & EF_PARISC_WIDE) |
| 133 | + pa64 = 1; |
| 134 | + } |
| 135 | + |
| 136 | + int nregs = pa64 ? 127 : 128; |
| 137 | + |
| 138 | + if (name == NULL) |
| 139 | + return nregs; |
| 140 | + |
| 141 | + if (regno < 0 || regno >= nregs || namelen < 6) |
| 142 | + return -1; |
| 143 | + |
| 144 | + *prefix = "%"; |
| 145 | + |
| 146 | + if (regno < 32) |
| 147 | + { |
| 148 | + *setname = "integer"; |
| 149 | + *type = DW_ATE_signed; |
| 150 | + if (pa64) |
| 151 | + { |
| 152 | + *bits = 64; |
| 153 | + } |
| 154 | + else |
| 155 | + { |
| 156 | + *bits = 32; |
| 157 | + } |
| 158 | + } |
| 159 | + else if (regno == 32) |
| 160 | + { |
| 161 | + *setname = "special"; |
| 162 | + if (pa64) |
| 163 | + { |
| 164 | + *bits = 6; |
| 165 | + } |
| 166 | + else |
| 167 | + { |
| 168 | + *bits = 5; |
| 169 | + } |
| 170 | + *type = DW_ATE_unsigned; |
| 171 | + } |
| 172 | + else |
| 173 | + { |
| 174 | + *setname = "FPU"; |
| 175 | + *type = DW_ATE_float; |
| 176 | + if (pa64) |
| 177 | + { |
| 178 | + *bits = 64; |
| 179 | + } |
| 180 | + else |
| 181 | + { |
| 182 | + *bits = 32; |
| 183 | + } |
| 184 | + } |
| 185 | + |
| 186 | + if (regno < 33) { |
| 187 | + switch (regno) |
| 188 | + { |
| 189 | + case 0 ... 9: |
| 190 | + name[0] = 'r'; |
| 191 | + name[1] = regno + '0'; |
| 192 | + namelen = 2; |
| 193 | + break; |
| 194 | + case 10 ... 31: |
| 195 | + name[0] = 'r'; |
| 196 | + name[1] = regno / 10 + '0'; |
| 197 | + name[2] = regno % 10 + '0'; |
| 198 | + namelen = 3; |
| 199 | + break; |
| 200 | + case 32: |
| 201 | + *prefix = NULL; |
| 202 | + name[0] = 'S'; |
| 203 | + name[1] = 'A'; |
| 204 | + name[2] = 'R'; |
| 205 | + namelen = 3; |
| 206 | + break; |
| 207 | + } |
| 208 | + } |
| 209 | + else { |
| 210 | + if (pa64 && ((regno - 72) % 2)) { |
| 211 | + *setname = NULL; |
| 212 | + return 0; |
| 213 | + } |
| 214 | + |
| 215 | + switch (regno) |
| 216 | + { |
| 217 | + case 72 + 0 ... 72 + 11: |
| 218 | + name[0] = 'f'; |
| 219 | + name[1] = 'r'; |
| 220 | + name[2] = (regno + 8 - 72) / 2 + '0'; |
| 221 | + namelen = 3; |
| 222 | + if ((regno + 8 - 72) % 2) { |
| 223 | + name[3] = 'R'; |
| 224 | + namelen++; |
| 225 | + } |
| 226 | + break; |
| 227 | + case 72 + 12 ... 72 + 55: |
| 228 | + name[0] = 'f'; |
| 229 | + name[1] = 'r'; |
| 230 | + name[2] = (regno + 8 - 72) / 2 / 10 + '0'; |
| 231 | + name[3] = (regno + 8 - 72) / 2 % 10 + '0'; |
| 232 | + namelen = 4; |
| 233 | + if ((regno + 8 - 72) % 2) { |
| 234 | + name[4] = 'R'; |
| 235 | + namelen++; |
| 236 | + } |
| 237 | + break; |
| 238 | + default: |
| 239 | + *setname = NULL; |
| 240 | + return 0; |
| 241 | + } |
| 242 | + } |
| 243 | + name[namelen++] = '\0'; |
| 244 | + return namelen; |
| 245 | +} |
| 246 | Index: elfutils-0.146/backends/parisc_reloc.def |
| 247 | =================================================================== |
| 248 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 249 | +++ elfutils-0.146/backends/parisc_reloc.def 2010-04-24 10:10:50.000000000 +0000 |
| 250 | @@ -0,0 +1,128 @@ |
| 251 | +/* List the relocation types for PA-RISC. -*- C -*- |
| 252 | + Copyright (C) 2005 Red Hat, Inc. |
| 253 | + This file is part of Red Hat elfutils. |
| 254 | + |
| 255 | + Red Hat elfutils is free software; you can redistribute it and/or modify |
| 256 | + it under the terms of the GNU General Public License as published by the |
| 257 | + Free Software Foundation; version 2 of the License. |
| 258 | + |
| 259 | + Red Hat elfutils is distributed in the hope that it will be useful, but |
| 260 | + WITHOUT ANY WARRANTY; without even the implied warranty of |
| 261 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 262 | + General Public License for more details. |
| 263 | + |
| 264 | + You should have received a copy of the GNU General Public License along |
| 265 | + with Red Hat elfutils; if not, write to the Free Software Foundation, |
| 266 | + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. |
| 267 | + |
| 268 | + Red Hat elfutils is an included package of the Open Invention Network. |
| 269 | + An included package of the Open Invention Network is a package for which |
| 270 | + Open Invention Network licensees cross-license their patents. No patent |
| 271 | + license is granted, either expressly or impliedly, by designation as an |
| 272 | + included package. Should you wish to participate in the Open Invention |
| 273 | + Network licensing program, please visit www.openinventionnetwork.com |
| 274 | + <http://www.openinventionnetwork.com>. */ |
| 275 | + |
| 276 | +/* NAME, REL|EXEC|DYN */ |
| 277 | + |
| 278 | +RELOC_TYPE (NONE, EXEC|DYN) |
| 279 | +RELOC_TYPE (DIR32, REL|EXEC|DYN) |
| 280 | +RELOC_TYPE (DIR21L, REL|EXEC|DYN) |
| 281 | +RELOC_TYPE (DIR17R, REL) |
| 282 | +RELOC_TYPE (DIR17F, REL) |
| 283 | +RELOC_TYPE (DIR14R, REL|DYN) |
| 284 | +RELOC_TYPE (PCREL32, REL) |
| 285 | +RELOC_TYPE (PCREL21L, REL) |
| 286 | +RELOC_TYPE (PCREL17R, REL) |
| 287 | +RELOC_TYPE (PCREL17F, REL) |
| 288 | +RELOC_TYPE (PCREL14R, REL|EXEC) |
| 289 | +RELOC_TYPE (DPREL21L, REL) |
| 290 | +RELOC_TYPE (DPREL14WR, REL) |
| 291 | +RELOC_TYPE (DPREL14DR, REL) |
| 292 | +RELOC_TYPE (DPREL14R, REL) |
| 293 | +RELOC_TYPE (GPREL21L, 0) |
| 294 | +RELOC_TYPE (GPREL14R, 0) |
| 295 | +RELOC_TYPE (LTOFF21L, REL) |
| 296 | +RELOC_TYPE (LTOFF14R, REL) |
| 297 | +RELOC_TYPE (DLTIND14F, 0) |
| 298 | +RELOC_TYPE (SETBASE, 0) |
| 299 | +RELOC_TYPE (SECREL32, REL) |
| 300 | +RELOC_TYPE (BASEREL21L, 0) |
| 301 | +RELOC_TYPE (BASEREL17R, 0) |
| 302 | +RELOC_TYPE (BASEREL14R, 0) |
| 303 | +RELOC_TYPE (SEGBASE, 0) |
| 304 | +RELOC_TYPE (SEGREL32, REL) |
| 305 | +RELOC_TYPE (PLTOFF21L, 0) |
| 306 | +RELOC_TYPE (PLTOFF14R, 0) |
| 307 | +RELOC_TYPE (PLTOFF14F, 0) |
| 308 | +RELOC_TYPE (LTOFF_FPTR32, 0) |
| 309 | +RELOC_TYPE (LTOFF_FPTR21L, 0) |
| 310 | +RELOC_TYPE (LTOFF_FPTR14R, 0) |
| 311 | +RELOC_TYPE (FPTR64, 0) |
| 312 | +RELOC_TYPE (PLABEL32, REL|DYN) |
| 313 | +RELOC_TYPE (PCREL64, 0) |
| 314 | +RELOC_TYPE (PCREL22C, 0) |
| 315 | +RELOC_TYPE (PCREL22F, 0) |
| 316 | +RELOC_TYPE (PCREL14WR, 0) |
| 317 | +RELOC_TYPE (PCREL14DR, 0) |
| 318 | +RELOC_TYPE (PCREL16F, 0) |
| 319 | +RELOC_TYPE (PCREL16WF, 0) |
| 320 | +RELOC_TYPE (PCREL16DF, 0) |
| 321 | +RELOC_TYPE (DIR64, REL|DYN) |
| 322 | +RELOC_TYPE (DIR14WR, REL) |
| 323 | +RELOC_TYPE (DIR14DR, REL) |
| 324 | +RELOC_TYPE (DIR16F, REL) |
| 325 | +RELOC_TYPE (DIR16WF, REL) |
| 326 | +RELOC_TYPE (DIR16DF, REL) |
| 327 | +RELOC_TYPE (GPREL64, 0) |
| 328 | +RELOC_TYPE (GPREL14WR, 0) |
| 329 | +RELOC_TYPE (GPREL14DR, 0) |
| 330 | +RELOC_TYPE (GPREL16F, 0) |
| 331 | +RELOC_TYPE (GPREL16WF, 0) |
| 332 | +RELOC_TYPE (GPREL16DF, 0) |
| 333 | +RELOC_TYPE (LTOFF64, 0) |
| 334 | +RELOC_TYPE (LTOFF14WR, 0) |
| 335 | +RELOC_TYPE (LTOFF14DR, 0) |
| 336 | +RELOC_TYPE (LTOFF16F, 0) |
| 337 | +RELOC_TYPE (LTOFF16WF, 0) |
| 338 | +RELOC_TYPE (LTOFF16DF, 0) |
| 339 | +RELOC_TYPE (SECREL64, 0) |
| 340 | +RELOC_TYPE (BASEREL14WR, 0) |
| 341 | +RELOC_TYPE (BASEREL14DR, 0) |
| 342 | +RELOC_TYPE (SEGREL64, 0) |
| 343 | +RELOC_TYPE (PLTOFF14WR, 0) |
| 344 | +RELOC_TYPE (PLTOFF14DR, 0) |
| 345 | +RELOC_TYPE (PLTOFF16F, 0) |
| 346 | +RELOC_TYPE (PLTOFF16WF, 0) |
| 347 | +RELOC_TYPE (PLTOFF16DF, 0) |
| 348 | +RELOC_TYPE (LTOFF_FPTR64, 0) |
| 349 | +RELOC_TYPE (LTOFF_FPTR14WR, 0) |
| 350 | +RELOC_TYPE (LTOFF_FPTR14DR, 0) |
| 351 | +RELOC_TYPE (LTOFF_FPTR16F, 0) |
| 352 | +RELOC_TYPE (LTOFF_FPTR16WF, 0) |
| 353 | +RELOC_TYPE (LTOFF_FPTR16DF, 0) |
| 354 | +RELOC_TYPE (COPY, EXEC) |
| 355 | +RELOC_TYPE (IPLT, EXEC|DYN) |
| 356 | +RELOC_TYPE (EPLT, 0) |
| 357 | +RELOC_TYPE (TPREL32, DYN) |
| 358 | +RELOC_TYPE (TPREL21L, 0) |
| 359 | +RELOC_TYPE (TPREL14R, 0) |
| 360 | +RELOC_TYPE (LTOFF_TP21L, 0) |
| 361 | +RELOC_TYPE (LTOFF_TP14R, 0) |
| 362 | +RELOC_TYPE (LTOFF_TP14F, 0) |
| 363 | +RELOC_TYPE (TPREL64, 0) |
| 364 | +RELOC_TYPE (TPREL14WR, 0) |
| 365 | +RELOC_TYPE (TPREL14DR, 0) |
| 366 | +RELOC_TYPE (TPREL16F, 0) |
| 367 | +RELOC_TYPE (TPREL16WF, 0) |
| 368 | +RELOC_TYPE (TPREL16DF, 0) |
| 369 | +RELOC_TYPE (LTOFF_TP64, 0) |
| 370 | +RELOC_TYPE (LTOFF_TP14WR, 0) |
| 371 | +RELOC_TYPE (LTOFF_TP14DR, 0) |
| 372 | +RELOC_TYPE (LTOFF_TP16F, 0) |
| 373 | +RELOC_TYPE (LTOFF_TP16WF, 0) |
| 374 | +RELOC_TYPE (LTOFF_TP16DF, 0) |
| 375 | +RELOC_TYPE (TLS_DTPMOD32, DYN) |
| 376 | +RELOC_TYPE (TLS_DTPMOD64, DYN) |
| 377 | + |
| 378 | +#define NO_RELATIVE_RELOC 1 |
| 379 | Index: elfutils-0.146/backends/parisc_retval.c |
| 380 | =================================================================== |
| 381 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 382 | +++ elfutils-0.146/backends/parisc_retval.c 2010-04-24 10:10:50.000000000 +0000 |
| 383 | @@ -0,0 +1,213 @@ |
| 384 | +/* Function return value location for Linux/PA-RISC ABI. |
| 385 | + Copyright (C) 2005 Red Hat, Inc. |
| 386 | + This file is part of Red Hat elfutils. |
| 387 | + |
| 388 | + Red Hat elfutils is free software; you can redistribute it and/or modify |
| 389 | + it under the terms of the GNU General Public License as published by the |
| 390 | + Free Software Foundation; version 2 of the License. |
| 391 | + |
| 392 | + Red Hat elfutils is distributed in the hope that it will be useful, but |
| 393 | + WITHOUT ANY WARRANTY; without even the implied warranty of |
| 394 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 395 | + General Public License for more details. |
| 396 | + |
| 397 | + You should have received a copy of the GNU General Public License along |
| 398 | + with Red Hat elfutils; if not, write to the Free Software Foundation, |
| 399 | + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. |
| 400 | + |
| 401 | + Red Hat elfutils is an included package of the Open Invention Network. |
| 402 | + An included package of the Open Invention Network is a package for which |
| 403 | + Open Invention Network licensees cross-license their patents. No patent |
| 404 | + license is granted, either expressly or impliedly, by designation as an |
| 405 | + included package. Should you wish to participate in the Open Invention |
| 406 | + Network licensing program, please visit www.openinventionnetwork.com |
| 407 | + <http://www.openinventionnetwork.com>. */ |
| 408 | + |
| 409 | +#ifdef HAVE_CONFIG_H |
| 410 | +# include <config.h> |
| 411 | +#endif |
| 412 | + |
| 413 | +#include <assert.h> |
| 414 | +#include <dwarf.h> |
| 415 | + |
| 416 | +#define BACKEND parisc_ |
| 417 | +#include "libebl_CPU.h" |
| 418 | +#include "libebl_parisc.h" |
| 419 | + |
| 420 | +/* %r28, or pair %r28, %r29. */ |
| 421 | +static const Dwarf_Op loc_intreg32[] = |
| 422 | + { |
| 423 | + { .atom = DW_OP_reg28 }, { .atom = DW_OP_piece, .number = 4 }, |
| 424 | + { .atom = DW_OP_reg29 }, { .atom = DW_OP_piece, .number = 4 }, |
| 425 | + }; |
| 426 | + |
| 427 | +static const Dwarf_Op loc_intreg[] = |
| 428 | + { |
| 429 | + { .atom = DW_OP_reg28 }, { .atom = DW_OP_piece, .number = 8 }, |
| 430 | + { .atom = DW_OP_reg29 }, { .atom = DW_OP_piece, .number = 8 }, |
| 431 | + }; |
| 432 | +#define nloc_intreg 1 |
| 433 | +#define nloc_intregpair 4 |
| 434 | + |
| 435 | +/* %fr4L, or pair %fr4L, %fr4R on pa-32 */ |
| 436 | +static const Dwarf_Op loc_fpreg32[] = |
| 437 | + { |
| 438 | + { .atom = DW_OP_regx, .number = 72 }, { .atom = DW_OP_piece, .number = 4 }, |
| 439 | + { .atom = DW_OP_regx, .number = 73 }, { .atom = DW_OP_piece, .number = 4 }, |
| 440 | + }; |
| 441 | +#define nloc_fpreg32 2 |
| 442 | +#define nloc_fpregpair32 4 |
| 443 | + |
| 444 | +/* $fr4 */ |
| 445 | +static const Dwarf_Op loc_fpreg[] = |
| 446 | + { |
| 447 | + { .atom = DW_OP_regx, .number = 72 }, |
| 448 | + }; |
| 449 | +#define nloc_fpreg 1 |
| 450 | + |
| 451 | +#if 0 |
| 452 | +/* The return value is a structure and is actually stored in stack space |
| 453 | + passed in a hidden argument by the caller. Address of the location is stored |
| 454 | + in %r28 before function call, but it may be changed by function. */ |
| 455 | +static const Dwarf_Op loc_aggregate[] = |
| 456 | + { |
| 457 | + { .atom = DW_OP_breg28 }, |
| 458 | + }; |
| 459 | +#define nloc_aggregate 1 |
| 460 | +#endif |
| 461 | + |
| 462 | +static int |
| 463 | +parisc_return_value_location_ (Dwarf_Die *functypedie, const Dwarf_Op **locp, int pa64) |
| 464 | +{ |
| 465 | + Dwarf_Word regsize = pa64 ? 8 : 4; |
| 466 | + |
| 467 | + /* Start with the function's type, and get the DW_AT_type attribute, |
| 468 | + which is the type of the return value. */ |
| 469 | + |
| 470 | + Dwarf_Attribute attr_mem; |
| 471 | + Dwarf_Attribute *attr = dwarf_attr_integrate (functypedie, DW_AT_type, &attr_mem); |
| 472 | + if (attr == NULL) |
| 473 | + /* The function has no return value, like a `void' function in C. */ |
| 474 | + return 0; |
| 475 | + |
| 476 | + Dwarf_Die die_mem; |
| 477 | + Dwarf_Die *typedie = dwarf_formref_die (attr, &die_mem); |
| 478 | + int tag = dwarf_tag (typedie); |
| 479 | + |
| 480 | + /* Follow typedefs and qualifiers to get to the actual type. */ |
| 481 | + while (tag == DW_TAG_typedef |
| 482 | + || tag == DW_TAG_const_type || tag == DW_TAG_volatile_type |
| 483 | + || tag == DW_TAG_restrict_type || tag == DW_TAG_mutable_type) |
| 484 | + { |
| 485 | + attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); |
| 486 | + typedie = dwarf_formref_die (attr, &die_mem); |
| 487 | + tag = dwarf_tag (typedie); |
| 488 | + } |
| 489 | + |
| 490 | + switch (tag) |
| 491 | + { |
| 492 | + case -1: |
| 493 | + return -1; |
| 494 | + |
| 495 | + case DW_TAG_subrange_type: |
| 496 | + if (! dwarf_hasattr_integrate (typedie, DW_AT_byte_size)) |
| 497 | + { |
| 498 | + attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); |
| 499 | + typedie = dwarf_formref_die (attr, &die_mem); |
| 500 | + tag = dwarf_tag (typedie); |
| 501 | + } |
| 502 | + /* Fall through. */ |
| 503 | + |
| 504 | + case DW_TAG_base_type: |
| 505 | + case DW_TAG_enumeration_type: |
| 506 | + case DW_TAG_pointer_type: |
| 507 | + case DW_TAG_ptr_to_member_type: |
| 508 | + { |
| 509 | + Dwarf_Word size; |
| 510 | + if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, |
| 511 | + &attr_mem), &size) != 0) |
| 512 | + { |
| 513 | + if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type) |
| 514 | + size = 4; |
| 515 | + else |
| 516 | + return -1; |
| 517 | + } |
| 518 | + if (tag == DW_TAG_base_type) |
| 519 | + { |
| 520 | + Dwarf_Word encoding; |
| 521 | + if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_encoding, |
| 522 | + &attr_mem), &encoding) != 0) |
| 523 | + return -1; |
| 524 | + |
| 525 | + if (encoding == DW_ATE_float) |
| 526 | + { |
| 527 | + if (pa64) { |
| 528 | + *locp = loc_fpreg; |
| 529 | + if (size <= 8) |
| 530 | + return nloc_fpreg; |
| 531 | + } |
| 532 | + else { |
| 533 | + *locp = loc_fpreg32; |
| 534 | + if (size <= 4) |
| 535 | + return nloc_fpreg32; |
| 536 | + else if (size <= 8) |
| 537 | + return nloc_fpregpair32; |
| 538 | + } |
| 539 | + goto aggregate; |
| 540 | + } |
| 541 | + } |
| 542 | + if (pa64) |
| 543 | + *locp = loc_intreg; |
| 544 | + else |
| 545 | + *locp = loc_intreg32; |
| 546 | + if (size <= regsize) |
| 547 | + return nloc_intreg; |
| 548 | + if (size <= 2 * regsize) |
| 549 | + return nloc_intregpair; |
| 550 | + |
| 551 | + /* Else fall through. */ |
| 552 | + } |
| 553 | + |
| 554 | + case DW_TAG_structure_type: |
| 555 | + case DW_TAG_class_type: |
| 556 | + case DW_TAG_union_type: |
| 557 | + case DW_TAG_array_type: |
| 558 | + aggregate: { |
| 559 | + Dwarf_Word size; |
| 560 | + if (dwarf_aggregate_size (typedie, &size) != 0) |
| 561 | + return -1; |
| 562 | + if (pa64) |
| 563 | + *locp = loc_intreg; |
| 564 | + else |
| 565 | + *locp = loc_intreg32; |
| 566 | + if (size <= regsize) |
| 567 | + return nloc_intreg; |
| 568 | + if (size <= 2 * regsize) |
| 569 | + return nloc_intregpair; |
| 570 | +#if 0 |
| 571 | + /* there should be some way to know this location... But I do not see it. */ |
| 572 | + *locp = loc_aggregate; |
| 573 | + return nloc_aggregate; |
| 574 | +#endif |
| 575 | + /* fall through. */ |
| 576 | + } |
| 577 | + } |
| 578 | + |
| 579 | + /* XXX We don't have a good way to return specific errors from ebl calls. |
| 580 | + This value means we do not understand the type, but it is well-formed |
| 581 | + DWARF and might be valid. */ |
| 582 | + return -2; |
| 583 | +} |
| 584 | + |
| 585 | +int |
| 586 | +parisc_return_value_location_32 (Dwarf_Die *functypedie, const Dwarf_Op **locp) |
| 587 | +{ |
| 588 | + return parisc_return_value_location_ (functypedie, locp, 0); |
| 589 | +} |
| 590 | + |
| 591 | +int |
| 592 | +parisc_return_value_location_64 (Dwarf_Die *functypedie, const Dwarf_Op **locp) |
| 593 | +{ |
| 594 | + return parisc_return_value_location_ (functypedie, locp, 1); |
| 595 | +} |
| 596 | + |
| 597 | Index: elfutils-0.146/backends/parisc_symbol.c |
| 598 | =================================================================== |
| 599 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 600 | +++ elfutils-0.146/backends/parisc_symbol.c 2010-04-24 10:10:50.000000000 +0000 |
| 601 | @@ -0,0 +1,112 @@ |
| 602 | +/* PA-RISC specific symbolic name handling. |
| 603 | + Copyright (C) 2002, 2005 Red Hat, Inc. |
| 604 | + This file is part of Red Hat elfutils. |
| 605 | + Written by Ulrich Drepper <drepper@redhat.com>, 2002. |
| 606 | + |
| 607 | + Red Hat elfutils is free software; you can redistribute it and/or modify |
| 608 | + it under the terms of the GNU General Public License as published by the |
| 609 | + Free Software Foundation; version 2 of the License. |
| 610 | + |
| 611 | + Red Hat elfutils is distributed in the hope that it will be useful, but |
| 612 | + WITHOUT ANY WARRANTY; without even the implied warranty of |
| 613 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 614 | + General Public License for more details. |
| 615 | + |
| 616 | + You should have received a copy of the GNU General Public License along |
| 617 | + with Red Hat elfutils; if not, write to the Free Software Foundation, |
| 618 | + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. |
| 619 | + |
| 620 | + Red Hat elfutils is an included package of the Open Invention Network. |
| 621 | + An included package of the Open Invention Network is a package for which |
| 622 | + Open Invention Network licensees cross-license their patents. No patent |
| 623 | + license is granted, either expressly or impliedly, by designation as an |
| 624 | + included package. Should you wish to participate in the Open Invention |
| 625 | + Network licensing program, please visit www.openinventionnetwork.com |
| 626 | + <http://www.openinventionnetwork.com>. */ |
| 627 | + |
| 628 | +#ifdef HAVE_CONFIG_H |
| 629 | +# include <config.h> |
| 630 | +#endif |
| 631 | + |
| 632 | +#include <elf.h> |
| 633 | +#include <stddef.h> |
| 634 | + |
| 635 | +#define BACKEND parisc_ |
| 636 | +#include "libebl_CPU.h" |
| 637 | + |
| 638 | +const char * |
| 639 | +parisc_segment_type_name (int segment, char *buf __attribute__ ((unused)), |
| 640 | + size_t len __attribute__ ((unused))) |
| 641 | +{ |
| 642 | + switch (segment) |
| 643 | + { |
| 644 | + case PT_PARISC_ARCHEXT: |
| 645 | + return "PARISC_ARCHEXT"; |
| 646 | + case PT_PARISC_UNWIND: |
| 647 | + return "PARISC_UNWIND"; |
| 648 | + default: |
| 649 | + break; |
| 650 | + } |
| 651 | + return NULL; |
| 652 | +} |
| 653 | + |
| 654 | +/* Return symbolic representation of symbol type. */ |
| 655 | +const char * |
| 656 | +parisc_symbol_type_name(int symbol, char *buf __attribute__ ((unused)), |
| 657 | + size_t len __attribute__ ((unused))) |
| 658 | +{ |
| 659 | + if (symbol == STT_PARISC_MILLICODE) |
| 660 | + return "PARISC_MILLI"; |
| 661 | + return NULL; |
| 662 | +} |
| 663 | + |
| 664 | +/* Return symbolic representation of section type. */ |
| 665 | +const char * |
| 666 | +parisc_section_type_name (int type, |
| 667 | + char *buf __attribute__ ((unused)), |
| 668 | + size_t len __attribute__ ((unused))) |
| 669 | +{ |
| 670 | + switch (type) |
| 671 | + { |
| 672 | + case SHT_PARISC_EXT: |
| 673 | + return "PARISC_EXT"; |
| 674 | + case SHT_PARISC_UNWIND: |
| 675 | + return "PARISC_UNWIND"; |
| 676 | + case SHT_PARISC_DOC: |
| 677 | + return "PARISC_DOC"; |
| 678 | + } |
| 679 | + |
| 680 | + return NULL; |
| 681 | +} |
| 682 | + |
| 683 | +/* Check whether machine flags are valid. */ |
| 684 | +bool |
| 685 | +parisc_machine_flag_check (GElf_Word flags) |
| 686 | +{ |
| 687 | + if (flags &~ (EF_PARISC_TRAPNIL | EF_PARISC_EXT | EF_PARISC_LSB | |
| 688 | + EF_PARISC_WIDE | EF_PARISC_NO_KABP | |
| 689 | + EF_PARISC_LAZYSWAP | EF_PARISC_ARCH)) |
| 690 | + return 0; |
| 691 | + |
| 692 | + GElf_Word arch = flags & EF_PARISC_ARCH; |
| 693 | + |
| 694 | + return ((arch == EFA_PARISC_1_0) || (arch == EFA_PARISC_1_1) || |
| 695 | + (arch == EFA_PARISC_2_0)); |
| 696 | +} |
| 697 | + |
| 698 | +/* Check for the simple reloc types. */ |
| 699 | +Elf_Type |
| 700 | +parisc_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type) |
| 701 | +{ |
| 702 | + switch (type) |
| 703 | + { |
| 704 | + case R_PARISC_DIR64: |
| 705 | + case R_PARISC_SECREL64: |
| 706 | + return ELF_T_XWORD; |
| 707 | + case R_PARISC_DIR32: |
| 708 | + case R_PARISC_SECREL32: |
| 709 | + return ELF_T_WORD; |
| 710 | + default: |
| 711 | + return ELF_T_NUM; |
| 712 | + } |
| 713 | +} |
| 714 | Index: elfutils-0.146/backends/libebl_parisc.h |
| 715 | =================================================================== |
| 716 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 717 | +++ elfutils-0.146/backends/libebl_parisc.h 2010-04-24 10:10:50.000000000 +0000 |
| 718 | @@ -0,0 +1,9 @@ |
| 719 | +#ifndef _LIBEBL_HPPA_H |
| 720 | +#define _LIBEBL_HPPA_H 1 |
| 721 | + |
| 722 | +#include <libdw.h> |
| 723 | + |
| 724 | +extern int parisc_return_value_location_32(Dwarf_Die *, const Dwarf_Op **locp); |
| 725 | +extern int parisc_return_value_location_64(Dwarf_Die *, const Dwarf_Op **locp); |
| 726 | + |
| 727 | +#endif |
| 728 | Index: elfutils-0.146/backends/Makefile.am |
| 729 | =================================================================== |
| 730 | --- elfutils-0.146.orig/backends/Makefile.am 2010-04-24 10:10:41.000000000 +0000 |
| 731 | +++ elfutils-0.146/backends/Makefile.am 2010-04-24 10:10:50.000000000 +0000 |
| 732 | @@ -29,11 +29,11 @@ |
| 733 | -I$(top_srcdir)/libelf -I$(top_srcdir)/libdw |
| 734 | |
| 735 | |
| 736 | -modules = i386 sh x86_64 ia64 alpha arm sparc ppc ppc64 s390 |
| 737 | +modules = i386 sh x86_64 ia64 alpha arm sparc ppc ppc64 s390 parisc |
| 738 | libebl_pic = libebl_i386_pic.a libebl_sh_pic.a libebl_x86_64_pic.a \ |
| 739 | libebl_ia64_pic.a libebl_alpha_pic.a libebl_arm_pic.a \ |
| 740 | libebl_sparc_pic.a libebl_ppc_pic.a libebl_ppc64_pic.a \ |
| 741 | - libebl_s390_pic.a |
| 742 | + libebl_s390_pic.a libebl_parisc_pic.a |
| 743 | noinst_LIBRARIES = $(libebl_pic) |
| 744 | noinst_DATA = $(libebl_pic:_pic.a=.so) |
| 745 | |
| 746 | @@ -95,6 +95,9 @@ |
| 747 | libebl_s390_pic_a_SOURCES = $(s390_SRCS) |
| 748 | am_libebl_s390_pic_a_OBJECTS = $(s390_SRCS:.c=.os) |
| 749 | |
| 750 | +parisc_SRCS = parisc_init.c parisc_symbol.c parisc_regs.c parisc_retval.c |
| 751 | +libebl_parisc_pic_a_SOURCES = $(parisc_SRCS) |
| 752 | +am_libebl_parisc_pic_a_OBJECTS = $(parisc_SRCS:.c=.os) |
| 753 | |
| 754 | libebl_%.so libebl_%.map: libebl_%_pic.a $(libelf) $(libdw) |
| 755 | @rm -f $(@:.so=.map) |
| 756 | Index: elfutils-0.146/libelf/elf.h |
| 757 | =================================================================== |
| 758 | --- elfutils-0.146.orig/libelf/elf.h 2010-04-13 20:08:02.000000000 +0000 |
| 759 | +++ elfutils-0.146/libelf/elf.h 2010-04-24 10:10:50.000000000 +0000 |
| 760 | @@ -1789,16 +1789,24 @@ |
| 761 | #define R_PARISC_PCREL17F 12 /* 17 bits of rel. address. */ |
| 762 | #define R_PARISC_PCREL14R 14 /* Right 14 bits of rel. address. */ |
| 763 | #define R_PARISC_DPREL21L 18 /* Left 21 bits of rel. address. */ |
| 764 | +#define R_PARISC_DPREL14WR 19 |
| 765 | +#define R_PARISC_DPREL14DR 20 |
| 766 | #define R_PARISC_DPREL14R 22 /* Right 14 bits of rel. address. */ |
| 767 | #define R_PARISC_GPREL21L 26 /* GP-relative, left 21 bits. */ |
| 768 | #define R_PARISC_GPREL14R 30 /* GP-relative, right 14 bits. */ |
| 769 | #define R_PARISC_LTOFF21L 34 /* LT-relative, left 21 bits. */ |
| 770 | #define R_PARISC_LTOFF14R 38 /* LT-relative, right 14 bits. */ |
| 771 | +#define R_PARISC_DLTIND14F 39 |
| 772 | +#define R_PARISC_SETBASE 40 |
| 773 | #define R_PARISC_SECREL32 41 /* 32 bits section rel. address. */ |
| 774 | +#define R_PARISC_BASEREL21L 42 |
| 775 | +#define R_PARISC_BASEREL17R 43 |
| 776 | +#define R_PARISC_BASEREL14R 46 |
| 777 | #define R_PARISC_SEGBASE 48 /* No relocation, set segment base. */ |
| 778 | #define R_PARISC_SEGREL32 49 /* 32 bits segment rel. address. */ |
| 779 | #define R_PARISC_PLTOFF21L 50 /* PLT rel. address, left 21 bits. */ |
| 780 | #define R_PARISC_PLTOFF14R 54 /* PLT rel. address, right 14 bits. */ |
| 781 | +#define R_PARISC_PLTOFF14F 55 |
| 782 | #define R_PARISC_LTOFF_FPTR32 57 /* 32 bits LT-rel. function pointer. */ |
| 783 | #define R_PARISC_LTOFF_FPTR21L 58 /* LT-rel. fct ptr, left 21 bits. */ |
| 784 | #define R_PARISC_LTOFF_FPTR14R 62 /* LT-rel. fct ptr, right 14 bits. */ |
| 785 | @@ -1807,6 +1815,7 @@ |
| 786 | #define R_PARISC_PLABEL21L 66 /* Left 21 bits of fdesc address. */ |
| 787 | #define R_PARISC_PLABEL14R 70 /* Right 14 bits of fdesc address. */ |
| 788 | #define R_PARISC_PCREL64 72 /* 64 bits PC-rel. address. */ |
| 789 | +#define R_PARISC_PCREL22C 73 |
| 790 | #define R_PARISC_PCREL22F 74 /* 22 bits PC-rel. address. */ |
| 791 | #define R_PARISC_PCREL14WR 75 /* PC-rel. address, right 14 bits. */ |
| 792 | #define R_PARISC_PCREL14DR 76 /* PC rel. address, right 14 bits. */ |
| 793 | @@ -1832,6 +1841,8 @@ |
| 794 | #define R_PARISC_LTOFF16WF 102 /* 16 bits LT-rel. address. */ |
| 795 | #define R_PARISC_LTOFF16DF 103 /* 16 bits LT-rel. address. */ |
| 796 | #define R_PARISC_SECREL64 104 /* 64 bits section rel. address. */ |
| 797 | +#define R_PARISC_BASEREL14WR 107 |
| 798 | +#define R_PARISC_BASEREL14DR 108 |
| 799 | #define R_PARISC_SEGREL64 112 /* 64 bits segment rel. address. */ |
| 800 | #define R_PARISC_PLTOFF14WR 115 /* PLT-rel. address, right 14 bits. */ |
| 801 | #define R_PARISC_PLTOFF14DR 116 /* PLT-rel. address, right 14 bits. */ |