summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/elfutils/elfutils/m68k_backend.diff
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/elfutils/elfutils/m68k_backend.diff')
-rw-r--r--meta/recipes-devtools/elfutils/elfutils/m68k_backend.diff309
1 files changed, 309 insertions, 0 deletions
diff --git a/meta/recipes-devtools/elfutils/elfutils/m68k_backend.diff b/meta/recipes-devtools/elfutils/elfutils/m68k_backend.diff
new file mode 100644
index 0000000..5b621f9
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils/m68k_backend.diff
@@ -0,0 +1,309 @@
1Upstream-Status: Backport
2
3Index: elfutils-0.146/backends/m68k_init.c
4===================================================================
5--- /dev/null 1970-01-01 00:00:00.000000000 +0000
6+++ elfutils-0.146/backends/m68k_init.c 2010-04-24 10:11:38.000000000 +0000
7@@ -0,0 +1,49 @@
8+/* Initialization of m68k specific backend library.
9+ Copyright (C) 2007 Kurt Roeckx <kurt@roeckx.be>
10+
11+ This software 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+ This softare 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 this software; if not, write to the Free Software Foundation,
22+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
23+
24+*/
25+
26+#ifdef HAVE_CONFIG_H
27+# include <config.h>
28+#endif
29+
30+#define BACKEND m68k_
31+#define RELOC_PREFIX R_68K_
32+#include "libebl_CPU.h"
33+
34+/* This defines the common reloc hooks based on m68k_reloc.def. */
35+#include "common-reloc.c"
36+
37+
38+const char *
39+m68k_init (elf, machine, eh, ehlen)
40+ Elf *elf __attribute__ ((unused));
41+ GElf_Half machine __attribute__ ((unused));
42+ Ebl *eh;
43+ size_t ehlen;
44+{
45+ /* Check whether the Elf_BH object has a sufficent size. */
46+ if (ehlen < sizeof (Ebl))
47+ return NULL;
48+
49+ /* We handle it. */
50+ eh->name = "m68k";
51+ m68k_init_reloc (eh);
52+ HOOK (eh, reloc_simple_type);
53+ HOOK (eh, register_info);
54+
55+ return MODVERSION;
56+}
57Index: elfutils-0.146/backends/m68k_regs.c
58===================================================================
59--- /dev/null 1970-01-01 00:00:00.000000000 +0000
60+++ elfutils-0.146/backends/m68k_regs.c 2010-04-24 10:11:38.000000000 +0000
61@@ -0,0 +1,106 @@
62+/* Register names and numbers for m68k DWARF.
63+ Copyright (C) 2007 Kurt Roeckx <kurt@roeckx.be>
64+
65+ This software is free software; you can redistribute it and/or modify
66+ it under the terms of the GNU General Public License as published by the
67+ Free Software Foundation; version 2 of the License.
68+
69+ This software is distributed in the hope that it will be useful, but
70+ WITHOUT ANY WARRANTY; without even the implied warranty of
71+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
72+ General Public License for more details.
73+
74+ You should have received a copy of the GNU General Public License along
75+ with this software; if not, write to the Free Software Foundation,
76+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
77+
78+ */
79+
80+#ifdef HAVE_CONFIG_H
81+# include <config.h>
82+#endif
83+
84+#include <string.h>
85+#include <dwarf.h>
86+
87+#define BACKEND m68k_
88+#include "libebl_CPU.h"
89+
90+ssize_t
91+m68k_register_info (Ebl *ebl __attribute__ ((unused)),
92+ int regno, char *name, size_t namelen,
93+ const char **prefix, const char **setname,
94+ int *bits, int *type)
95+{
96+ if (name == NULL)
97+ return 25;
98+
99+ if (regno < 0 || regno > 24 || namelen < 5)
100+ return -1;
101+
102+ *prefix = "%";
103+ *bits = 32;
104+ *type = (regno < 8 ? DW_ATE_signed
105+ : regno < 16 ? DW_ATE_address : DW_ATE_float);
106+
107+ if (regno < 8)
108+ {
109+ *setname = "integer";
110+ }
111+ else if (regno < 16)
112+ {
113+ *setname = "address";
114+ }
115+ else if (regno < 24)
116+ {
117+ *setname = "FPU";
118+ }
119+ else
120+ {
121+ *setname = "address";
122+ *type = DW_ATE_address;
123+ }
124+
125+ switch (regno)
126+ {
127+ case 0 ... 7:
128+ name[0] = 'd';
129+ name[1] = regno + '0';
130+ namelen = 2;
131+ break;
132+
133+ case 8 ... 13:
134+ name[0] = 'a';
135+ name[1] = regno - 8 + '0';
136+ namelen = 2;
137+ break;
138+
139+ case 14:
140+ name[0] = 'f';
141+ name[1] = 'p';
142+ namelen = 2;
143+ break;
144+
145+ case 15:
146+ name[0] = 's';
147+ name[1] = 'p';
148+ namelen = 2;
149+ break;
150+
151+ case 16 ... 23:
152+ name[0] = 'f';
153+ name[1] = 'p';
154+ name[2] = regno - 16 + '0';
155+ namelen = 3;
156+ break;
157+
158+ case 24:
159+ name[0] = 'p';
160+ name[1] = 'c';
161+ namelen = 2;
162+ }
163+
164+ name[namelen++] = '\0';
165+ return namelen;
166+}
167+
168Index: elfutils-0.146/backends/m68k_reloc.def
169===================================================================
170--- /dev/null 1970-01-01 00:00:00.000000000 +0000
171+++ elfutils-0.146/backends/m68k_reloc.def 2010-04-24 10:11:38.000000000 +0000
172@@ -0,0 +1,45 @@
173+/* List the relocation types for m68k. -*- C -*-
174+ Copyright (C) 2007 Kurt Roeckx <kurt@roeckx.be>
175+
176+ This software 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+ This software 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 this software; if not, write to the Free Software Foundation,
187+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
188+*/
189+
190+/* NAME, REL|EXEC|DYN */
191+
192+RELOC_TYPE (NONE, 0)
193+RELOC_TYPE (32, REL|EXEC|DYN)
194+RELOC_TYPE (16, REL)
195+RELOC_TYPE (8, REL)
196+RELOC_TYPE (PC32, REL|EXEC|DYN)
197+RELOC_TYPE (PC16, REL)
198+RELOC_TYPE (PC8, REL)
199+RELOC_TYPE (GOT32, REL)
200+RELOC_TYPE (GOT16, REL)
201+RELOC_TYPE (GOT8, REL)
202+RELOC_TYPE (GOT32O, REL)
203+RELOC_TYPE (GOT16O, REL)
204+RELOC_TYPE (GOT8O, REL)
205+RELOC_TYPE (PLT32, REL)
206+RELOC_TYPE (PLT16, REL)
207+RELOC_TYPE (PLT8, REL)
208+RELOC_TYPE (PLT32O, REL)
209+RELOC_TYPE (PLT16O, REL)
210+RELOC_TYPE (PLT8O, REL)
211+RELOC_TYPE (COPY, EXEC)
212+RELOC_TYPE (GLOB_DAT, EXEC|DYN)
213+RELOC_TYPE (JMP_SLOT, EXEC|DYN)
214+RELOC_TYPE (RELATIVE, EXEC|DYN)
215+RELOC_TYPE (GNU_VTINHERIT, REL)
216+RELOC_TYPE (GNU_VTENTRY, REL)
217+
218Index: elfutils-0.146/libelf/elf.h
219===================================================================
220--- elfutils-0.146.orig/libelf/elf.h 2010-04-24 10:11:13.000000000 +0000
221+++ elfutils-0.146/libelf/elf.h 2010-04-24 10:13:50.000000000 +0000
222@@ -1125,6 +1125,9 @@
223 #define R_68K_GLOB_DAT 20 /* Create GOT entry */
224 #define R_68K_JMP_SLOT 21 /* Create PLT entry */
225 #define R_68K_RELATIVE 22 /* Adjust by program base */
226+/* The next 2 are GNU extensions to enable C++ vtable garbage collection. */
227+#define R_68K_GNU_VTINHERIT 23
228+#define R_68K_GNU_VTENTRY 24
229 #define R_68K_TLS_GD32 25 /* 32 bit GOT offset for GD */
230 #define R_68K_TLS_GD16 26 /* 16 bit GOT offset for GD */
231 #define R_68K_TLS_GD8 27 /* 8 bit GOT offset for GD */
232Index: elfutils-0.146/backends/Makefile.am
233===================================================================
234--- elfutils-0.146.orig/backends/Makefile.am 2010-04-24 10:11:23.000000000 +0000
235+++ elfutils-0.146/backends/Makefile.am 2010-04-24 10:11:38.000000000 +0000
236@@ -29,11 +29,12 @@
237 -I$(top_srcdir)/libelf -I$(top_srcdir)/libdw
238
239
240-modules = i386 sh x86_64 ia64 alpha arm sparc ppc ppc64 s390 parisc mips
241+modules = i386 sh x86_64 ia64 alpha arm sparc ppc ppc64 s390 parisc mips m68k
242 libebl_pic = libebl_i386_pic.a libebl_sh_pic.a libebl_x86_64_pic.a \
243 libebl_ia64_pic.a libebl_alpha_pic.a libebl_arm_pic.a \
244 libebl_sparc_pic.a libebl_ppc_pic.a libebl_ppc64_pic.a \
245- libebl_s390_pic.a libebl_parisc_pic.a libebl_mips_pic.a
246+ libebl_s390_pic.a libebl_parisc_pic.a libebl_mips_pic.a \
247+ libebl_m68k_pic.a
248 noinst_LIBRARIES = $(libebl_pic)
249 noinst_DATA = $(libebl_pic:_pic.a=.so)
250
251@@ -103,6 +104,10 @@
252 libebl_mips_pic_a_SOURCES = $(mips_SRCS)
253 am_libebl_mips_pic_a_OBJECTS = $(mips_SRCS:.c=.os)
254
255+m68k_SRCS = m68k_init.c m68k_symbol.c m68k_regs.c
256+libebl_m68k_pic_a_SOURCES = $(m68k_SRCS)
257+am_libebl_m68k_pic_a_OBJECTS = $(m68k_SRCS:.c=.os)
258+
259 libebl_%.so libebl_%.map: libebl_%_pic.a $(libelf) $(libdw)
260 @rm -f $(@:.so=.map)
261 echo 'ELFUTILS_$(PACKAGE_VERSION) { global: $*_init; local: *; };' \
262Index: elfutils-0.146/backends/m68k_symbol.c
263===================================================================
264--- /dev/null 1970-01-01 00:00:00.000000000 +0000
265+++ elfutils-0.146/backends/m68k_symbol.c 2010-04-24 10:11:38.000000000 +0000
266@@ -0,0 +1,43 @@
267+/* m68k specific symbolic name handling.
268+ Copyright (C) 2007 Kurt Roeckx <kurt@roeckx.be>
269+
270+ This software is free software; you can redistribute it and/or modify
271+ it under the terms of the GNU General Public License as published by the
272+ Free Software Foundation; version 2 of the License.
273+
274+ This software distributed in the hope that it will be useful, but
275+ WITHOUT ANY WARRANTY; without even the implied warranty of
276+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
277+ General Public License for more details.
278+
279+ You should have received a copy of the GNU General Public License along
280+ with this software; if not, write to the Free Software Foundation,
281+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
282+*/
283+
284+#ifdef HAVE_CONFIG_H
285+# include <config.h>
286+#endif
287+
288+#include <elf.h>
289+#include <stddef.h>
290+
291+#define BACKEND m68k_
292+#include "libebl_CPU.h"
293+
294+/* Check for the simple reloc types. */
295+Elf_Type
296+m68k_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type)
297+{
298+ switch (type)
299+ {
300+ case R_68K_32:
301+ return ELF_T_SWORD;
302+ case R_68K_16:
303+ return ELF_T_HALF;
304+ case R_68K_8:
305+ return ELF_T_BYTE;
306+ default:
307+ return ELF_T_NUM;
308+ }
309+}