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