OSDN Git Service

* elf32-hppa.c (hppa_unwind_entry_compare): Move to elf-hppa.h.
[pf3gnuchains/pf3gnuchains4x.git] / bfd / elf32-sh-lin.c
1 /* Hitachi SH specific support for 32-bit Linux
2    Copyright 2000, 2001 Free Software Foundation, Inc.
3
4 This file is part of BFD, the Binary File Descriptor library.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
19
20 #define TARGET_BIG_SYM bfd_elf32_shblin_vec
21 #define TARGET_BIG_NAME "elf32-shbig-linux"
22 #define TARGET_LITTLE_SYM bfd_elf32_shlin_vec
23 #define TARGET_LITTLE_NAME "elf32-sh-linux"
24 #define ELF_ARCH bfd_arch_sh
25 #define ELF_MACHINE_CODE EM_SH
26 #define ELF_MAXPAGESIZE 0x10000
27 #define elf_symbol_leading_char 0
28
29 #include "bfd.h"
30 #include "sysdep.h"
31 #include "elf/internal.h"
32 #include "elf-bfd.h"
33
34 static boolean elf32_shlin_grok_prstatus
35   PARAMS ((bfd *abfd, Elf_Internal_Note *note));
36 static boolean elf32_shlin_grok_psinfo
37   PARAMS ((bfd *abfd, Elf_Internal_Note *note));
38
39 /* Support for core dump NOTE sections */
40 static boolean
41 elf32_shlin_grok_prstatus (abfd, note)
42      bfd *abfd;
43      Elf_Internal_Note *note;
44 {
45   int offset;
46   unsigned int raw_size;
47
48   switch (note->descsz)
49     {
50       default:
51         return false;
52
53       case 168:         /* Linux/SH */
54         /* pr_cursig */
55         elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
56
57         /* pr_pid */
58         elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
59
60         /* pr_reg */
61         offset = 72;
62         raw_size = 92;
63
64         break;
65     }
66
67   /* Make a ".reg/999" section.  */
68   return _bfd_elfcore_make_pseudosection (abfd, ".reg",
69                                           raw_size, note->descpos + offset);
70 }
71
72 static boolean
73 elf32_shlin_grok_psinfo (abfd, note)
74      bfd *abfd;
75      Elf_Internal_Note *note;
76 {
77   switch (note->descsz)
78     {
79       default:
80         return false;
81
82       case 124:         /* Linux/SH elf_prpsinfo */
83         elf_tdata (abfd)->core_program
84          = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
85         elf_tdata (abfd)->core_command
86          = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
87     }
88
89   /* Note that for some reason, a spurious space is tacked
90      onto the end of the args in some (at least one anyway)
91      implementations, so strip it off if it exists.  */
92
93   {
94     char *command = elf_tdata (abfd)->core_command;
95     int n = strlen (command);
96
97     if (0 < n && command[n - 1] == ' ')
98       command[n - 1] = '\0';
99   }
100
101   return true;
102 }
103 \f
104
105 #define elf_backend_grok_prstatus       elf32_shlin_grok_prstatus
106 #define elf_backend_grok_psinfo         elf32_shlin_grok_psinfo
107
108
109
110 #include "elf32-sh.c"