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