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