]> git.pld-linux.org Git - packages/elfutils.git/blame - elfutils-alpha.patch
- updated for 0.121 (from FC)
[packages/elfutils.git] / elfutils-alpha.patch
CommitLineData
4867747f 12006-04-16 Jakub Bogusz <qboosh at pld-linux dot org>
96b9de17
JB
2
3 * src/elflint.c (valid_e_machine) Add EM_ALPHA to valid machines.
4 (check_hash): Support hash bucket size of 8 on alpha and s390x.
5 (check_sections): Support arch-specific section flags.
74321b06
JB
6 * libelf/elf32_getshdr.c: Handle unaligned section header with same
7 endianess properly.
4867747f
JB
8 * backends/alpha_init.c: Add register_name hook.
9 * backends/alpha_regs.c: New file.
10 * backends/Makefile.am: Add alpha_regs.c.
96b9de17
JB
11
12--- elfutils-0.116/src/elflint.c.orig 2005-11-26 10:28:00.000000000 +0100
13+++ elfutils-0.116/src/elflint.c 2005-11-26 14:01:18.000000000 +0100
14@@ -331,7 +331,7 @@
15 EM_68HC16, EM_68HC11, EM_68HC08, EM_68HC05, EM_SVX, EM_ST19, EM_VAX,
16 EM_CRIS, EM_JAVELIN, EM_FIREPATH, EM_ZSP, EM_MMIX, EM_HUANY, EM_PRISM,
17 EM_AVR, EM_FR30, EM_D10V, EM_D30V, EM_V850, EM_M32R, EM_MN10300,
18- EM_MN10200, EM_PJ, EM_OPENRISC, EM_ARC_A5, EM_XTENSA
19+ EM_MN10200, EM_PJ, EM_OPENRISC, EM_ARC_A5, EM_XTENSA, EM_ALPHA
20 };
21 #define nvalid_e_machine \
22 (sizeof (valid_e_machine) / sizeof (valid_e_machine[0]))
23@@ -1664,6 +1664,16 @@
24 section [%2d] '%s': hash table not for dynamic symbol table\n"),
25 idx, section_name (ebl, idx));
26
27+ bool bighash =
28+ (ehdr->e_machine == EM_ALPHA) ||
29+ ((ehdr->e_machine == EM_S390) && (ehdr->e_ident[EI_CLASS] == ELFCLASS64));
30+
31+ if (bighash) {
32+ if (shdr->sh_entsize != 8) /* alpha and s390x use non-standard hash bucket size of 8 */
33+ ERROR (gettext ("\
34+section [%2d] '%s': entry size is not 8\n"),
35+ idx, section_name (ebl, idx));
36+ } else
37 if (shdr->sh_entsize != sizeof (Elf32_Word))
38 ERROR (gettext ("\
39 section [%2d] '%s': entry size does not match Elf32_Word\n"),
40@@ -1681,8 +1691,15 @@
41 return;
42 }
43
44- Elf32_Word nbucket = ((Elf32_Word *) data->d_buf)[0];
45- Elf32_Word nchain = ((Elf32_Word *) data->d_buf)[1];
46+ uint64_t nbucket, nchain;
47+
48+ if (bighash) {
49+ nbucket = ((Elf64_Xword *) data->d_buf)[0];
50+ nchain = ((Elf64_Xword *) data->d_buf)[1];
51+ } else {
52+ nbucket = ((Elf32_Word *) data->d_buf)[0];
53+ nchain = ((Elf32_Word *) data->d_buf)[1];
54+ }
55
56 if (shdr->sh_size < (2 + nbucket + nchain) * shdr->sh_entsize)
57 ERROR (gettext ("\
58@@ -1694,29 +1711,41 @@
59 {
60 size_t symsize = symshdr->sh_size / symshdr->sh_entsize;
61 size_t cnt;
62- Elf32_Word *buf, *end;
63+ void *buf, *end;
64+ uint64_t val;
65
66 if (nchain < symshdr->sh_size / symshdr->sh_entsize)
67 ERROR (gettext ("section [%2d] '%s': chain array not large enough\n"),
68 idx, section_name (ebl, idx));
69
70+ if (bighash) {
71+ buf = ((Elf64_Xword *) data->d_buf) + 2;
72+ end = (Elf64_Xword *) ((char *) data->d_buf + shdr->sh_size);
73+ } else {
74 buf = ((Elf32_Word *) data->d_buf) + 2;
75 end = (Elf32_Word *) ((char *) data->d_buf + shdr->sh_size);
76- for (cnt = 2; cnt < 2 + nbucket; ++cnt)
77+ }
78+ for (cnt = 2; cnt < 2 + nbucket; ++cnt) {
79 if (buf >= end)
80 return;
81- else if (*buf++ >= symsize)
82+ val = bighash ? *(Elf64_Xword *)buf : *(Elf32_Word *)buf;
83+ if (val >= symsize)
84 ERROR (gettext ("\
85 section [%2d] '%s': hash bucket reference %zu out of bounds\n"),
86 idx, section_name (ebl, idx), cnt - 2);
87+ buf += bighash ? 8 : sizeof(Elf32_Word);
88+ }
89
90- for (; cnt < 2 + nbucket + nchain; ++cnt)
91+ for (; cnt < 2 + nbucket + nchain; ++cnt) {
92 if (buf >= end)
93 return;
94- else if (*buf++ >= symsize)
95+ val = bighash ? *(Elf64_Xword *)buf : *(Elf32_Word *)buf;
96+ if (val >= symsize)
97 ERROR (gettext ("\
98 section [%2d] '%s': hash chain reference %zu out of bounds\n"),
99 idx, section_name (ebl, idx), cnt - 2 - nbucket);
100+ buf += bighash ? 8 : sizeof(Elf32_Word);
101+ }
102 }
103 }
104
105@@ -2744,9 +2773,30 @@
106 cnt, section_name (ebl, cnt),
107 (int) shdr->sh_type);
108
109-#define ALL_SH_FLAGS (SHF_WRITE | SHF_ALLOC | SHF_EXECINSTR | SHF_MERGE \
110+#define GALL_SH_FLAGS (SHF_WRITE | SHF_ALLOC | SHF_EXECINSTR | SHF_MERGE \
111 | SHF_STRINGS | SHF_INFO_LINK | SHF_LINK_ORDER \
112 | SHF_OS_NONCONFORMING | SHF_GROUP | SHF_TLS)
113+ uint64_t ALL_SH_FLAGS = GALL_SH_FLAGS; /* generic */
114+ switch (ehdr->e_machine) {
115+ case EM_MIPS:
116+ ALL_SH_FLAGS |= SHF_MIPS_GPREL | SHF_MIPS_MERGE | SHF_MIPS_ADDR |
117+ SHF_MIPS_STRINGS | SHF_MIPS_NOSTRIP | SHF_MIPS_LOCAL |
118+ SHF_MIPS_NAMES | SHF_MIPS_NODUPE;
119+ break;
120+ case EM_PARISC:
121+ ALL_SH_FLAGS |= SHF_PARISC_SHORT | SHF_PARISC_HUGE | SHF_PARISC_SBP;
122+ break;
123+ case EM_ALPHA:
124+ ALL_SH_FLAGS |= SHF_ALPHA_GPREL;
125+ break;
126+ case EM_ARM:
127+ ALL_SH_FLAGS |= SHF_ARM_ENTRYSECT | SHF_ARM_COMDEF;
128+ break;
129+ case EM_IA_64:
130+ ALL_SH_FLAGS |= SHF_IA_64_SHORT | SHF_IA_64_NORECOV;
131+ break;
132+ }
133+
134 if (shdr->sh_flags & ~ALL_SH_FLAGS)
135 ERROR (gettext ("section [%2zu] '%s' contains unknown flag(s)"
136 " %#" PRIx64 "\n"),
74321b06
JB
137--- elfutils-0.119/libelf/elf32_getshdr.c.orig 2006-02-05 18:17:07.948304250 +0100
138+++ elfutils-0.119/libelf/elf32_getshdr.c 2006-02-05 18:26:52.836857500 +0100
139@@ -107,7 +107,10 @@
96b9de17
JB
140 }
141
142 /* Now copy the data and at the same time convert the byte
143- order. */
144+ order, if needed. */
145+ if (ehdr->e_ident[EI_DATA] == MY_ELFDATA)
146+ memcpy (shdr, ((char*) elf->map_address + elf->start_offset + ehdr->e_shoff), size);
147+ else {
148 if (ALLOW_UNALIGNED
74321b06
JB
149 || (((uintptr_t) elf->map_address + elf->start_offset
150 + ehdr->e_shoff)
151@@ -136,6 +139,7 @@
96b9de17
JB
152 CONVERT_TO (shdr[cnt].sh_addralign, notcvt[cnt].sh_addralign);
153 CONVERT_TO (shdr[cnt].sh_entsize, notcvt[cnt].sh_entsize);
154 }
155+ }
156 }
157 else if (likely (elf->fildes != -1))
158 {
4867747f
JB
159--- elfutils-0.120/backends/alpha_init.c.orig 2006-04-05 00:17:36.000000000 +0200
160+++ elfutils-0.120/backends/alpha_init.c 2006-04-16 13:11:08.819218500 +0200
161@@ -54,6 +54,7 @@
162 HOOK (eh, dynamic_tag_check);
163 HOOK (eh, reloc_simple_type);
164 HOOK (eh, return_value_location);
165+ HOOK (eh, register_name);
166
167 return MODVERSION;
168 }
169--- elfutils-0.120/backends/alpha_regs.c.orig 1970-01-01 01:00:00.000000000 +0100
170+++ elfutils-0.120/backends/alpha_regs.c 2006-04-16 13:10:15.947914250 +0200
171@@ -0,0 +1,81 @@
172+/* Register names and numbers for ALPHA DWARF.
173+ Based on i386_regs.c, Copyright (C) 2005 Red Hat, Inc.
174+ This file is part of Red Hat elfutils.
175+
176+ Red Hat elfutils is free software; you can redistribute it and/or modify
177+ it under the terms of the GNU General Public License as published by the
178+ Free Software Foundation; version 2 of the License.
179+
180+ Red Hat elfutils is distributed in the hope that it will be useful, but
181+ WITHOUT ANY WARRANTY; without even the implied warranty of
182+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
183+ General Public License for more details.
184+
185+ You should have received a copy of the GNU General Public License along
186+ with Red Hat elfutils; if not, write to the Free Software Foundation,
187+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
188+
189+ Red Hat elfutils is an included package of the Open Invention Network.
190+ An included package of the Open Invention Network is a package for which
191+ Open Invention Network licensees cross-license their patents. No patent
192+ license is granted, either expressly or impliedly, by designation as an
193+ included package. Should you wish to participate in the Open Invention
194+ Network licensing program, please visit www.openinventionnetwork.com
195+ <http://www.openinventionnetwork.com>. */
196+
197+#ifdef HAVE_CONFIG_H
198+# include <config.h>
199+#endif
200+
201+#include <string.h>
202+
203+#define BACKEND alpha_
204+#include "libebl_CPU.h"
205+
206+ssize_t
207+alpha_register_name (Ebl *ebl __attribute__ ((unused)),
208+ int regno, char *name, size_t namelen,
209+ const char **prefix, const char **setname)
210+{
211+ if (name == NULL)
212+ return 33;
213+
214+ if (regno < 0 || regno > 64 || namelen < 5)
215+ return -1;
216+
217+ *prefix = "%";
218+ if (regno < 32)
219+ *setname = "integer";
220+ else if (regno < 64)
221+ *setname = "fp";
222+ else
223+ *setname = "pc";
224+
225+ switch (regno)
226+ {
227+ static const char *alpharegs[] =
228+ {
229+ "v0", "t0", "t1", "t2", "t3", "t4", "t5", "t6",
230+ "t7", "s0", "s1", "s2", "s3", "s4", "s5", "s6",
231+ "a0", "a1", "a2", "a3", "a4", "a5", "t8", "t9",
232+ "t10","t11","ra", "t12","at", "gp", "sp", "zero",
233+ "fv0","fv1","fs0","fs1","fs2","fs3","fs4","fs5",
234+ "fs6","fs7","ft0","ft1","ft2","ft3","ft4","ft5",
235+ "fa0","fa1","fa2","fa3","fa4","fa5","ft6","ft7",
236+ "ft8","ft9","ft10","ft11","ft12","ft13","ft14","fzero",
237+ "pc"
238+ };
239+
240+ case 0 ... 64:
241+ strcpy(name, alpharegs[regno]);
242+ namelen = strlen(name);
243+ break;
244+
245+ default:
246+ name[0] = '\0';
247+ *setname = NULL;
248+ return 0;
249+ }
250+
251+ return namelen;
252+}
253--- elfutils-0.120/backends/Makefile.am.orig 2006-04-16 13:15:56.425192000 +0200
254+++ elfutils-0.120/backends/Makefile.am 2006-04-16 13:28:26.928096250 +0200
255@@ -90,7 +90,7 @@
256 libebl_ia64_pic_a_SOURCES = $(ia64_SRCS)
257 am_libebl_ia64_pic_a_OBJECTS = $(ia64_SRCS:.c=.os)
258
259-alpha_SRCS = alpha_init.c alpha_symbol.c alpha_retval.c
260+alpha_SRCS = alpha_init.c alpha_symbol.c alpha_retval.c alpha_regs.c
261 libebl_alpha_pic_a_SOURCES = $(alpha_SRCS)
262 am_libebl_alpha_pic_a_OBJECTS = $(alpha_SRCS:.c=.os)
263
This page took 0.054692 seconds and 4 git commands to generate.