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