~ubuntu-branches/ubuntu/saucy/cell-gdb/saucy

« back to all changes in this revision

Viewing changes to debian/oldp/ppu/diff-bfd-corewrite

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-09-24 09:56:11 UTC
  • Revision ID: james.westby@ubuntu.com-20070924095611-n3moal4rh1vhx221
Tags: 6.6.50cvs20070623-1ubuntu1
Fix build dependencies for powerpc.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
diff -urpN gdb-6.6.orig/bfd/elf32-ppc.c gdb-6.6/bfd/elf32-ppc.c
2
 
--- gdb-6.6.orig/bfd/elf32-ppc.c        2006-11-03 11:28:09.000000000 +1030
3
 
+++ gdb-6.6/bfd/elf32-ppc.c     2007-02-28 21:27:39.000000000 +1030
4
 
@@ -25,6 +25,7 @@
5
 
    suggestions from the in-progress Embedded PowerPC ABI, and that
6
 
    information may also not match.  */
7
 
 
8
 
+#include <stdarg.h>
9
 
 #include "bfd.h"
10
 
 #include "sysdep.h"
11
 
 #include "bfdlink.h"
12
 
@@ -1813,6 +1814,52 @@ ppc_elf_grok_psinfo (bfd *abfd, Elf_Inte
13
 
   return TRUE;
14
 
 }
15
 
 
16
 
+static char *
17
 
+ppc_elf_write_core_note (bfd *abfd, char *buf, int *bufsiz, int note_type, ...)
18
 
+{
19
 
+  switch (note_type)
20
 
+    {
21
 
+    default:
22
 
+      return NULL;
23
 
+
24
 
+    case NT_PRPSINFO:
25
 
+      {
26
 
+       char data[128];
27
 
+       va_list ap;
28
 
+
29
 
+       va_start (ap, note_type);
30
 
+       memset (data, 0, 32);
31
 
+       strncpy (data + 32, va_arg (ap, const char *), 16);
32
 
+       strncpy (data + 48, va_arg (ap, const char *), 80);
33
 
+       va_end (ap);
34
 
+       return elfcore_write_note (abfd, buf, bufsiz,
35
 
+                                  "CORE", note_type, data, sizeof (data));
36
 
+      }
37
 
+
38
 
+    case NT_PRSTATUS:
39
 
+      {
40
 
+       char data[268];
41
 
+       va_list ap;
42
 
+       long pid;
43
 
+       int cursig;
44
 
+       const void *greg;
45
 
+
46
 
+       va_start (ap, note_type);
47
 
+       memset (data, 0, 72);
48
 
+       pid = va_arg (ap, long);
49
 
+       bfd_put_32 (abfd, pid, data + 24);
50
 
+       cursig = va_arg (ap, int);
51
 
+       bfd_put_16 (abfd, cursig, data + 12);
52
 
+       greg = va_arg (ap, const void *);
53
 
+       memcpy (data + 72, greg, 192);
54
 
+       memset (data + 264, 0, 4);
55
 
+       va_end (ap);
56
 
+       return elfcore_write_note (abfd, buf, bufsiz,
57
 
+                                  "CORE", note_type, data, sizeof (data));
58
 
+      }
59
 
+    }
60
 
+}
61
 
+
62
 
 /* Return address for Ith PLT stub in section PLT, for relocation REL
63
 
    or (bfd_vma) -1 if it should not be included.  */
64
 
 
65
 
@@ -7473,6 +7520,7 @@ ppc_elf_finish_dynamic_sections (bfd *ou
66
 
 #define elf_backend_additional_program_headers ppc_elf_additional_program_headers
67
 
 #define elf_backend_grok_prstatus              ppc_elf_grok_prstatus
68
 
 #define elf_backend_grok_psinfo                        ppc_elf_grok_psinfo
69
 
+#define elf_backend_write_core_note            ppc_elf_write_core_note
70
 
 #define elf_backend_reloc_type_class           ppc_elf_reloc_type_class
71
 
 #define elf_backend_begin_write_processing     ppc_elf_begin_write_processing
72
 
 #define elf_backend_final_write_processing     ppc_elf_final_write_processing
73
 
diff -urpN gdb-6.6.orig/bfd/elf64-ppc.c gdb-6.6/bfd/elf64-ppc.c
74
 
--- gdb-6.6.orig/bfd/elf64-ppc.c        2006-11-07 14:04:52.000000000 +1030
75
 
+++ gdb-6.6/bfd/elf64-ppc.c     2007-02-28 21:27:39.000000000 +1030
76
 
@@ -25,6 +25,7 @@
77
 
    http://www.linuxbase.org/spec/ELF/ppc64/PPC-elf64abi.txt, and
78
 
    http://www.linuxbase.org/spec/ELF/ppc64/spec/book1.html  */
79
 
 
80
 
+#include <stdarg.h>
81
 
 #include "bfd.h"
82
 
 #include "sysdep.h"
83
 
 #include "bfdlink.h"
84
 
@@ -84,6 +85,7 @@ static bfd_vma opd_entry_value
85
 
 #define elf_backend_object_p                 ppc64_elf_object_p
86
 
 #define elf_backend_grok_prstatus            ppc64_elf_grok_prstatus
87
 
 #define elf_backend_grok_psinfo                      ppc64_elf_grok_psinfo
88
 
+#define elf_backend_write_core_note          ppc64_elf_write_core_note
89
 
 #define elf_backend_create_dynamic_sections   ppc64_elf_create_dynamic_sections
90
 
 #define elf_backend_copy_indirect_symbol      ppc64_elf_copy_indirect_symbol
91
 
 #define elf_backend_add_symbol_hook          ppc64_elf_add_symbol_hook
92
 
@@ -2483,6 +2485,53 @@ ppc64_elf_grok_psinfo (bfd *abfd, Elf_In
93
 
   return TRUE;
94
 
 }
95
 
 
96
 
+static char *
97
 
+ppc64_elf_write_core_note (bfd *abfd, char *buf, int *bufsiz, int note_type,
98
 
+                          ...)
99
 
+{
100
 
+  switch (note_type)
101
 
+    {
102
 
+    default:
103
 
+      return NULL;
104
 
+
105
 
+    case NT_PRPSINFO:
106
 
+      {
107
 
+       char data[136];
108
 
+       va_list ap;
109
 
+
110
 
+       va_start (ap, note_type);
111
 
+       memset (data, 0, 40);
112
 
+       strncpy (data + 40, va_arg (ap, const char *), 16);
113
 
+       strncpy (data + 56, va_arg (ap, const char *), 80);
114
 
+       va_end (ap);
115
 
+       return elfcore_write_note (abfd, buf, bufsiz,
116
 
+                                  "CORE", note_type, data, sizeof (data));
117
 
+      }
118
 
+
119
 
+    case NT_PRSTATUS:
120
 
+      {
121
 
+       char data[504];
122
 
+       va_list ap;
123
 
+       long pid;
124
 
+       int cursig;
125
 
+       const void *greg;
126
 
+
127
 
+       va_start (ap, note_type);
128
 
+       memset (data, 0, 112);
129
 
+       pid = va_arg (ap, long);
130
 
+       bfd_put_32 (abfd, pid, data + 32);
131
 
+       cursig = va_arg (ap, int);
132
 
+       bfd_put_16 (abfd, cursig, data + 12);
133
 
+       greg = va_arg (ap, const void *);
134
 
+       memcpy (data + 112, greg, 384);
135
 
+       memset (data + 496, 0, 8);
136
 
+       va_end (ap);
137
 
+       return elfcore_write_note (abfd, buf, bufsiz,
138
 
+                                  "CORE", note_type, data, sizeof (data));
139
 
+      }
140
 
+    }
141
 
+}
142
 
+
143
 
 /* Merge backend specific data from an object file to the output
144
 
    object file when linking.  */
145
 
 
146
 
diff -urpN gdb-6.6.orig/bfd/elf-bfd.h gdb-6.6/bfd/elf-bfd.h
147
 
--- gdb-6.6.orig/bfd/elf-bfd.h  2006-11-03 01:50:31.000000000 +1030
148
 
+++ gdb-6.6/bfd/elf-bfd.h       2007-02-28 21:27:39.000000000 +1030
149
 
@@ -943,15 +943,19 @@ struct elf_backend_data
150
 
     (asection *, Elf_Internal_Rela *);
151
 
 
152
 
   /* This function, if defined, is called when an NT_PRSTATUS note is found
153
 
-     in a core file. */
154
 
+     in a core file.  */
155
 
   bfd_boolean (*elf_backend_grok_prstatus)
156
 
     (bfd *, Elf_Internal_Note *);
157
 
 
158
 
   /* This function, if defined, is called when an NT_PSINFO or NT_PRPSINFO
159
 
-     note is found in a core file. */
160
 
+     note is found in a core file.  */
161
 
   bfd_boolean (*elf_backend_grok_psinfo)
162
 
     (bfd *, Elf_Internal_Note *);
163
 
 
164
 
+  /* This function, if defined, is called to write a note to a corefile.  */
165
 
+  char *(*elf_backend_write_core_note)
166
 
+    (bfd *abfd, char *buf, int *bufsiz, int note_type, ...);
167
 
+
168
 
   /* Functions to print VMAs.  Special code to handle 64 bit ELF files.  */
169
 
   void (* elf_backend_sprintf_vma)
170
 
     (bfd *, char *, bfd_vma);
171
 
diff -urpN gdb-6.6.orig/bfd/elf.c gdb-6.6/bfd/elf.c
172
 
--- gdb-6.6.orig/bfd/elf.c      2007-02-28 21:25:44.000000000 +1030
173
 
+++ gdb-6.6/bfd/elf.c   2007-02-28 21:27:39.000000000 +1030
174
 
@@ -8183,22 +8183,52 @@ elfcore_write_prpsinfo (bfd  *abfd,
175
 
                        const char *fname,
176
 
                        const char *psargs)
177
 
 {
178
 
-  int note_type;
179
 
-  char *note_name = "CORE";
180
 
+  const char *note_name = "CORE";
181
 
+  const struct elf_backend_data *bed = get_elf_backend_data (abfd);
182
 
+
183
 
+  if (bed->elf_backend_write_core_note != NULL)
184
 
+    {
185
 
+      char *ret;
186
 
+      ret = (*bed->elf_backend_write_core_note) (abfd, buf, bufsiz,
187
 
+                                                NT_PRPSINFO, fname, psargs);
188
 
+      if (ret != NULL)
189
 
+       return ret;
190
 
+    }
191
 
+
192
 
+#if defined (HAVE_PRPSINFO32_T) || defined (HAVE_PSINFO32_T)
193
 
+  if (bed->s->elfclass == ELFCLASS32)
194
 
+    {
195
 
+#if defined (HAVE_PSINFO32_T)
196
 
+      psinfo32_t data;
197
 
+      int note_type = NT_PSINFO;
198
 
+#else
199
 
+      prpsinfo32_t data;
200
 
+      int note_type = NT_PRPSINFO;
201
 
+#endif
202
 
 
203
 
+      memset (&data, 0, sizeof (data));
204
 
+      strncpy (data.pr_fname, fname, sizeof (data.pr_fname));
205
 
+      strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs));
206
 
+      return elfcore_write_note (abfd, buf, bufsiz,
207
 
+                                note_name, note_type, &data, sizeof (data));
208
 
+    }
209
 
+  else
210
 
+#endif
211
 
+    {
212
 
 #if defined (HAVE_PSINFO_T)
213
 
-  psinfo_t  data;
214
 
-  note_type = NT_PSINFO;
215
 
+      psinfo_t data;
216
 
+      int note_type = NT_PSINFO;
217
 
 #else
218
 
-  prpsinfo_t data;
219
 
-  note_type = NT_PRPSINFO;
220
 
+      prpsinfo_t data;
221
 
+      int note_type = NT_PRPSINFO;
222
 
 #endif
223
 
 
224
 
-  memset (&data, 0, sizeof (data));
225
 
-  strncpy (data.pr_fname, fname, sizeof (data.pr_fname));
226
 
-  strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs));
227
 
-  return elfcore_write_note (abfd, buf, bufsiz,
228
 
-                            note_name, note_type, &data, sizeof (data));
229
 
+      memset (&data, 0, sizeof (data));
230
 
+      strncpy (data.pr_fname, fname, sizeof (data.pr_fname));
231
 
+      strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs));
232
 
+      return elfcore_write_note (abfd, buf, bufsiz,
233
 
+                                note_name, note_type, &data, sizeof (data));
234
 
+    }
235
 
 }
236
 
 #endif /* PSINFO_T or PRPSINFO_T */
237
 
 
238
 
@@ -8211,15 +8241,43 @@ elfcore_write_prstatus (bfd *abfd,
239
 
                        int cursig,
240
 
                        const void *gregs)
241
 
 {
242
 
-  prstatus_t prstat;
243
 
-  char *note_name = "CORE";
244
 
+  const char *note_name = "CORE";
245
 
+  const struct elf_backend_data *bed = get_elf_backend_data (abfd);
246
 
 
247
 
-  memset (&prstat, 0, sizeof (prstat));
248
 
-  prstat.pr_pid = pid;
249
 
-  prstat.pr_cursig = cursig;
250
 
-  memcpy (&prstat.pr_reg, gregs, sizeof (prstat.pr_reg));
251
 
-  return elfcore_write_note (abfd, buf, bufsiz,
252
 
-                            note_name, NT_PRSTATUS, &prstat, sizeof (prstat));
253
 
+  if (bed->elf_backend_write_core_note != NULL)
254
 
+    {
255
 
+      char *ret;
256
 
+      ret = (*bed->elf_backend_write_core_note) (abfd, buf, bufsiz,
257
 
+                                                NT_PRSTATUS,
258
 
+                                                pid, cursig, gregs);
259
 
+      if (ret != NULL)
260
 
+       return ret;
261
 
+    }
262
 
+
263
 
+#if defined (HAVE_PRSTATUS32_T)
264
 
+  if (bed->s->elfclass == ELFCLASS32)
265
 
+    {
266
 
+      prstatus32_t prstat;
267
 
+
268
 
+      memset (&prstat, 0, sizeof (prstat));
269
 
+      prstat.pr_pid = pid;
270
 
+      prstat.pr_cursig = cursig;
271
 
+      memcpy (&prstat.pr_reg, gregs, sizeof (prstat.pr_reg));
272
 
+      return elfcore_write_note (abfd, buf, bufsiz, note_name,
273
 
+                                NT_PRSTATUS, &prstat, sizeof (prstat));
274
 
+    }
275
 
+  else
276
 
+#endif
277
 
+    {
278
 
+      prstatus_t prstat;
279
 
+
280
 
+      memset (&prstat, 0, sizeof (prstat));
281
 
+      prstat.pr_pid = pid;
282
 
+      prstat.pr_cursig = cursig;
283
 
+      memcpy (&prstat.pr_reg, gregs, sizeof (prstat.pr_reg));
284
 
+      return elfcore_write_note (abfd, buf, bufsiz, note_name,
285
 
+                                NT_PRSTATUS, &prstat, sizeof (prstat));
286
 
+    }
287
 
 }
288
 
 #endif /* HAVE_PRSTATUS_T */
289
 
 
290
 
@@ -8233,7 +8291,7 @@ elfcore_write_lwpstatus (bfd *abfd,
291
 
                         const void *gregs)
292
 
 {
293
 
   lwpstatus_t lwpstat;
294
 
-  char *note_name = "CORE";
295
 
+  const char *note_name = "CORE";
296
 
 
297
 
   memset (&lwpstat, 0, sizeof (lwpstat));
298
 
   lwpstat.pr_lwpid  = pid >> 16;
299
 
@@ -8263,14 +8321,31 @@ elfcore_write_pstatus (bfd *abfd,
300
 
                       int cursig ATTRIBUTE_UNUSED,
301
 
                       const void *gregs ATTRIBUTE_UNUSED)
302
 
 {
303
 
-  pstatus_t pstat;
304
 
-  char *note_name = "CORE";
305
 
+  const char *note_name = "CORE";
306
 
+#if defined (HAVE_PSTATUS32_T)
307
 
+  const struct elf_backend_data *bed = get_elf_backend_data (abfd);
308
 
 
309
 
-  memset (&pstat, 0, sizeof (pstat));
310
 
-  pstat.pr_pid = pid & 0xffff;
311
 
-  buf = elfcore_write_note (abfd, buf, bufsiz, note_name,
312
 
-                           NT_PSTATUS, &pstat, sizeof (pstat));
313
 
-  return buf;
314
 
+  if (bed->s->elfclass == ELFCLASS32)
315
 
+    {
316
 
+      pstatus32_t pstat;
317
 
+
318
 
+      memset (&pstat, 0, sizeof (pstat));
319
 
+      pstat.pr_pid = pid & 0xffff;
320
 
+      buf = elfcore_write_note (abfd, buf, bufsiz, note_name,
321
 
+                               NT_PSTATUS, &pstat, sizeof (pstat));
322
 
+      return buf;
323
 
+    }
324
 
+  else
325
 
+#endif
326
 
+    {
327
 
+      pstatus_t pstat;
328
 
+
329
 
+      memset (&pstat, 0, sizeof (pstat));
330
 
+      pstat.pr_pid = pid & 0xffff;
331
 
+      buf = elfcore_write_note (abfd, buf, bufsiz, note_name,
332
 
+                               NT_PSTATUS, &pstat, sizeof (pstat));
333
 
+      return buf;
334
 
+    }
335
 
 }
336
 
 #endif /* HAVE_PSTATUS_T */
337
 
 
338
 
@@ -8281,7 +8356,7 @@ elfcore_write_prfpreg (bfd *abfd,
339
 
                       const void *fpregs,
340
 
                       int size)
341
 
 {
342
 
-  char *note_name = "CORE";
343
 
+  const char *note_name = "CORE";
344
 
   return elfcore_write_note (abfd, buf, bufsiz,
345
 
                             note_name, NT_FPREGSET, fpregs, size);
346
 
 }
347
 
diff -urpN gdb-6.6.orig/bfd/elfxx-target.h gdb-6.6/bfd/elfxx-target.h
348
 
--- gdb-6.6.orig/bfd/elfxx-target.h     2006-10-17 23:11:46.000000000 +0930
349
 
+++ gdb-6.6/bfd/elfxx-target.h  2007-02-28 21:27:39.000000000 +1030
350
 
@@ -457,6 +457,9 @@
351
 
 #ifndef elf_backend_grok_psinfo
352
 
 #define elf_backend_grok_psinfo                        NULL
353
 
 #endif
354
 
+#ifndef elf_backend_write_core_note
355
 
+#define elf_backend_write_core_note            NULL
356
 
+#endif
357
 
 #ifndef elf_backend_sprintf_vma
358
 
 #define elf_backend_sprintf_vma                        _bfd_elf_sprintf_vma
359
 
 #endif
360
 
@@ -632,6 +635,7 @@ static struct elf_backend_data elfNN_bed
361
 
   elf_backend_count_relocs,
362
 
   elf_backend_grok_prstatus,
363
 
   elf_backend_grok_psinfo,
364
 
+  elf_backend_write_core_note,
365
 
   elf_backend_sprintf_vma,
366
 
   elf_backend_fprintf_vma,
367
 
   elf_backend_reloc_type_class,